Dexter

CD Cover
No wonder 9.3/10 from IMDB , Dexter is sure fun to watch and the music stays in my mind just like the theme song from the X-file.

Tonight’s The Night (By: Michael C. Hall aka Dexter)
Dexter Main Title. (By: Rolfe Kent)
Wink (By: Daniel Licht)
Astor’s Birthday Party (By: Daniel Licht)
Epilogue – Bloodroom (By: Daniel Licht)
Blood Theme (By: Daniel Licht)
Some interesting Spanish songs:
Conoci La Paz (By: Beny Moré)
Flores Para Ti (By: Raw Artistic Soul Feat. Rafael Cortez)
Perfidia(By: Mambo All-Stars)

SQLCMD


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380

SQLCMD was first introduced with SQL Server 2005 and was designed as a replacement to old SQL utilities like OSQL and ISQL. SQLCMD was written from scratch, and a lot of effect was put into performance and features. Before typing sql in Management Studio query editor, do not forget to enable SQLCMD mode under Query menu. It will pass the script to the SQLCMD application instead of submitting it to the database engine directly.
Unlike old tools,with use ODBC to connect to SQL Server, SQLCMD uses more efficient OLE DB connection and allows you to make multiple connections to different servers within the same script. SQLCMD also provides the ability to pass variables from either command line arguments or within the script itself.

Samples:

To backup DB you can use the following script:

:SETVAR myConnection FENCO-DW1
:SETVAR myDatabase AdventureWorks
 
BACKUP DATABASE $(myDatabase) TO DISK='C:\Backups\$(myDatabase).bak'
GO

the result:

Processed 21312 pages for database 'AdventureWorks', file 'AdventureWorks_Data' on file 1.
Processed 1 pages for database 'AdventureWorks', file 'AdventureWorks_Log' on file 1.
BACKUP DATABASE successfully processed 21313 pages in 3.590 seconds (46.381 MB/sec).

Essential SQL Server Date Time Functions


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in D:\InetPub\vhosts\kwu-1639.package\kennywu.info\wwwroot\wp-content\plugins\wp-syntax\wp-syntax.php on line 380

Returns a datetime value for the specified year, month and day

CREATE FUNCTION [dbo].[ReturnDate](@YEAR INT, @MONTH INT, @DAY INT) RETURNS datetime
AS
    BEGIN
    RETURN dateadd(MONTH,((@Year-1900)*12)+@Month-1,@Day-1)
    END

Returns @DateTime at midnight; i.e., it removes the time portion of a DateTime value.

CREATE  FUNCTION DateOnly(@DateTime DateTime)
RETURNS datetime
AS
    BEGIN
    RETURN dateadd(dd,0, datediff(dd,0,@DateTime))
    END

Sample:

SELECT dbo.ReturnDate(YEAR(getdate()), MONTH(getdate()),1) -- returns the first day of the current month.
SELECT dbo.ReturnDate(YEAR(getdate()), MONTH(getdate())+1,0) -- returns the last day of the current month.

Go to there for details:
http://weblogs.sqlteam.com/jeffs/archive/2007/01/02/56079.aspx