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.


    OSQL -L

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


#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