SQLCMD

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

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

Windows 7 themes

  • Regional themes (Country themes):
  • Depends on on the language and location you pick during installation, Windows 7 offers you Regional specific Aero themes.

    Win 7 install
    Since the country US was selected, theme specific to United States will show in the theme option list.

    To find out more themes from differenct location (ie. country) go to:
    %SystemRoot%\Globalization\MCT

    Them you will see more choices like Canada, Australia, South Africa, and Great Britain.

  • Installed themes (Aero, etc):
  • All the installed themes: %SystemRoot%\Resources\Themes

  • Per-user installed themes:
  • local user: C:\Users\KennyToshiba\AppData\Local\Microsoft\Windows\Themes
    domain user: %AppData%\Microsoft\Windows\Themes

For more themes, you can head over to the Microsoft Personalization Gallery.