How to get SQL Server instance names on command prompt ?

To get list of SQL Server instances on (DOS) command prompt use any of the following commands.

    SQLCMD -L

    OSQL -L

Please note L must be capital. These commands will show SQL Server instances of any versions installed on a machine.

Reference: http://stackoverflow.com/questions/141154/how-can-i-determine-installed-sql-server-instances-and-their-versions

#sql-server, #sql-server-tips

Generating GUID in SQL Server ?

NewID() funtion can be used in SQL Server to generate GUID.

For example:

Select newid();

or to select into a variable:

declare @GUID nvarchar(50);
Select @GUID=NewID();
Print @GUID;

#sql-server, #sql-server-tsql