2012
Format Date in SQL Server
It’s very common to show the current date (i.e., month, day, and year) in different formats. Although you can obtain the current date with Microsoft SQL Server’s GETDATE function, getting the returned date in the format you need can take a lot of effort and code. The FormatDate UDF (user-defined function) provides dates in various formats by using the following options: Continue reading »
2012
Quickie – Concatenate Rows as a String
Today I needed to concatenate a field from multiple rows in SQL Server to get a list of people names. Instead of doing it in code, you can use the following syntax:
DECLARE @Names VARCHAR(8000)
SELECT @name = ”
SELECT @Names = @Names + ‘,’ + Names FROM People
SELECT SUBSTRING(2, @Names, 7998)
Happy Concatenating!!
2012
Problem with Database Restore
Last week, I restored a database from backup and was having the following error when trying to access the tables:
“The SELECT permission was denied on the object ‘extended_properties’, database ‘mssqlsystemresource’, schema ‘sys’”.
After some research, I found the next solution: Continue reading »
2011
Find Database Creation Date | Quickie
2011
Order BY Not Working in SQL Server Functions | Quickie
Ever created a function and needed to include the Order By clause. It would result in the following error being loaded:
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
The problem is that to use, it requires a TOP clause or FOR XML. By if you specify TOP 100, you’ll only get the first 100 rows. You can specify a big number that you might think will never exceed. But what if you do? The best bet is to use TOP 100 PERCENT.
This will get you all the rows and works in Functions.
2011
ASP.Net | Read Values from Javascript
Today I started checking out some videos about Windows CardSpace and ASP.Net for logging in and I saw how he used javascript to get client side input and use it in ASP.Net in the C# code.
First you need to create a HiddenField on your webForm and name it TokenField (any name would actually do)
<asp:HiddenField ID=”TokenField” runat=”server” />
To set the Hidden Field value in JavaScript use the following code: Continue reading »
2010
SQL Server 2005 | Add days, months and years to GetDate()
To get the current date in Sql Server queries and stored procedures, you use the GetDate() method. But what about to add a day or two to the current date, or add a month or years? To do it, you use the following query:
Add One Day
SELECT DateAdd(dd, 1, GetDate())
Add One Month Continue reading »
2010
SQL Server | Convert Varchar to UniqueIdentifier
There are 2 ways to Convert a string to a UniqueIdentifier (GUID) in SQL Server:
SELECT CAST(’449141d9-86c9-449d-be2c-1f171b4f4567′ as UNIQUEIDENTIFIER)
SELECT CONVERT(UNIQUEIDENTIFIER, ’449141d9-86c9-449d-be2c-1f171b4f4567′)
2010
SQL Server | Remove Special Characters
I needed to remove all the special characters from a field in a particular table in SQL Server to be used for searching purposes. After searching (binging
)… I found the next SQL Server Function which did the trick.
This Function Removes any special character from the string value passed. All characters except 0-9, a-z and A-Z are all removed, whilst the remaining characters are returned back.
ALTER FUNCTION dbo.RemoveSpecialCharacters
(
@s VARCHAR(256)
)
RETURNS VARCHAR(256) WITH SCHEMABINDING
BEGIN
IF (@s is null)
RETURN null Continue reading »
2010
Error 29506 | SQL Server 2005 Management Studio Express
When i binged (yes I’m using bing
), i found the following fix:
- Search for Command Prompt in the Start Window (don’t press enter)
- Right click on the shortcut found and select ‘Run as Administrator’
- In the command prompt change the current directory to the folder where the SSMSEE installer is stored
- Enter the following command .SQLServer2005_SSMSEE_x64.msi if you are running Windows 7/Vista 64 bit
- Enter the following command .SQLServer2005_SSMSEE.msi if you are running Windows 7/Vista 32 bit
- Press enter to start the installation
Happy Sql Server Managementing
Resources: here
What you missed
Check these Out!
Favourite Links
Tags
Archives
- May 2013 (2)
- January 2013 (2)
- December 2012 (5)
- November 2012 (4)
- October 2012 (3)
- September 2012 (1)
- August 2012 (4)
- July 2012 (2)
- June 2012 (1)
- May 2012 (10)
- February 2012 (6)
- December 2011 (2)
- October 2011 (3)
- September 2011 (1)
- April 2011 (6)
- March 2011 (14)
- February 2011 (9)
- January 2011 (10)
- December 2010 (6)
- November 2010 (10)
- October 2010 (6)
- September 2010 (10)
- August 2010 (4)
- June 2010 (10)
- May 2010 (2)
- April 2010 (1)
- March 2010 (1)
- July 2009 (1)
- June 2009 (1)
- April 2009 (4)
- March 2009 (1)
- February 2009 (5)
- January 2009 (10)
- December 2008 (8)
- November 2008 (4)
- September 2008 (6)
- August 2008 (11)
- June 2008 (2)
- May 2008 (3)
- March 2008 (1)
- February 2008 (1)
- November 2007 (1)
- September 2007 (2)
- July 2007 (2)
- June 2007 (1)
- May 2007 (2)
- February 2007 (3)
- January 2007 (4)
- November 2006 (1)
- October 2006 (1)
Categories
- Android (3)
- Apple (5)
- ASP.Net (37)
- Be Creative (1)
- Blackberry OS (1)
- CMS (5)
- Creative Computing (4)
- Crystal Reports (5)
- Day to Day (22)
- Deep Design Malta (8)
- Design and Development (22)
- Development Tools (15)
- Facebook (1)
- Games (3)
- Google Analytics (3)
- Google Gmail (1)
- Hotmail (1)
- Internet Explorer (7)
- iPhone/3G (19)
- iPod Touch (6)
- JavaScript (13)
- JQuery (3)
- Lumia (4)
- Microsoft (18)
- Microsoft SQL Server (21)
- Microsoft Visual Studio (27)
- MS Office (3)
- MVC (2)
- My Blog (3)
- NetBeans (1)
- Nokia (4)
- Off Topic (16)
- Online Services (3)
- Permissions (1)
- Phones and Tablets Platforms (7)
- Project NINE (11)
- PSP NGP (1)
- Quickie (9)
- SEO (7)
- Silverlight For WP7 (4)
- Sitefinity (1)
- Sony (1)
- Uncategorized (32)
- Utilities (57)
- VB .Net (1)
- Windows 7 (14)
- Windows 8 (3)
- Windows Live (3)
- Windows Mobile (5)
- Windows Phone 7 (18)
- Windows Phone 8 (1)
- Windows Vista (15)
- Wordpress (1)
- WP Apps (2)
- Yellow Pages (4)








