Randomness – Wallpaper/Images

Hi guys, just to mix it up a bit I thought I’d post some wallpapers I’ve come across that I could share with you all. Sources include DEVIANTART and HYBRIDWORKS. If the artwork is yours, please let me know so I can credit you 🙂

Enjoy!

Advertisements

July 3, 2008 at 12:59 am Leave a comment

How do I execute the same SQL code multiple times?

Use the command GO. The following example demonstrates how GO can be used to execute the same code multiple times.

SELECT GETDATE() AS CurrentTime GO 3

The result below will be displayed with “Result to Text” mode turned on.

CurrentTime
———————–
2008-06-20 11:52:54.200 (1 row(s) affected)

CurrentTime
———————–
2008-06-20 11:52:54.217 (1 row(s) affected)

CurrentTime
———————–
2008-06-20 11:52:54.217 (1 row(s) affected)

June 22, 2008 at 12:21 am Leave a comment

How do I check if a SQL Server 2005 installation has been Service Packed?

You can check whether a SQL Server 2005 installation has been service packed by running the following SQL code:

SELECT SERVERPROPERTY (‘productlevel’)

If SQL Server has been service packed, it will return with the Service Pack version installed, eg. “SP2”. If it has not been service packed, it will return with the result “RTM”.

June 14, 2008 at 1:17 am Leave a comment

How do I create and use a Synonym for a table in SQL Server 2005?

To create a synonym, run the following SQL code:

USE AdventureWorks;
GO
CREATE SYNONYM MyLocation
FOR AdventureWorks.Production.Location;
GO

To use the synonym, run the following SQL code:

USE AdventureWorks;
GO
SELECT TOP 5 * FROM MyLocation;
GO

To drop the synonym, run the following SQL code:

USE AdventureWorks;
GO
DROP SYNONYM MyLocation;
GO

June 14, 2008 at 1:06 am Leave a comment

How do I list all tables WITHOUT a primary key?

Run the following SQL code:

SELECT T.TABLE_NAME AS “Tables without PKs”
FROM INFORMATION_SCHEMA.TABLES AS T
WHERE NOT EXISTS
(SELECT *
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
WHERE CONSTRAINT_TYPE = ‘PRIMARY KEY’
AND T.TABLE_NAME = TC.TABLE_NAME)
AND T.TABLE_TYPE = ‘BASE TABLE’

June 7, 2008 at 12:17 am Leave a comment

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.

June 6, 2008 at 11:36 pm Leave a comment

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.

June 6, 2008 at 11:27 pm Leave a comment

Older Posts


Calendar

December 2017
M T W T F S S
« Jul    
 123
45678910
11121314151617
18192021222324
25262728293031

Archives

Blog Stats

  • 32,563 hits