Archive for June 6th, 2008

How do I pad an Integer to 4 digits with leading zeros?

Run the following SQL code:

SELECT RIGHT(‘0000′ + YourValue), 4)

Note: To pad to a different number of digits, replace the ‘0000′ and the 4 as appropriate, eg. SELECT RIGHT(‘00000000′ + YourValue), 8) will pad to 8 digits.

Add comment June 6, 2008

How do I check the Default Server Collation (case-sensitivity) of a SQL Server installation?

To check the Default Server Collation of a SQL Server installation, run the following SQL query:

sp_helpsort

You should get a result similar to this:



Note:
To check the collation of a particular database, right click on the database in SQL Server Enterprise Manager (2000) or Management Studio (2005) and click Properties. The collation will be displayed in the Collation Name field.

Add comment June 6, 2008


Calendar

June 2008
M T W T F S S
    Jul »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Recent Posts

Archives

Blog Stats