July 2010
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  

Sql Server Tip 3

Tip#3: Try to use CAST instead of CONVERT. CAST is ANSI-92 standard but CONVERT works in MS SQL server only. Also, some CONVERT styles may be deprecated in future MS SQL releases.

Creating Tricker when Insert Update

– ================================================
– Template generated from Template Explorer using:
– Create Trigger (New Menu).SQL

– Use the Specify Values for Template Parameters
– command (Ctrl-Shift-M) to fill in the parameter
– values below.

– See additional Create Trigger templates for more
– examples of different Trigger statements.

– This block of comments will not be included in
– the definition of the function.
– ================================================
SET [...]

CASE WHEN in sql command

SELECT Name, RatingID AS Rating,
   CASE RatingID
      WHEN ‘R’ THEN ‘Under 17 requires an adult.‘
      WHEN ‘X’ THEN ‘No one 17 and under.‘
      WHEN ‘NR’ THEN ‘Use discretion when renting.‘
      ELSE ‘OK to rent to minors.‘
   END AS Policy
FROM DVDs
ORDER BY Name;

backup restore sql server 2005

RESTORE DATABASE PersonnelTestFixDept

FROM DISK = ‘C:\db1.bak’

WITH REPLACE