Table Row in String

How to create the row data as string.
If you have table row data and you need to show all the records in a single string, use the following query.
DATA:
——————–
Name
RAM
SHYAM
HARI
RITA

RESULT:
———————
Name
RAM,SHYAM,HARI,RITA

Use the following query
————————————
DECLARE @strList varchar(100)
SELECT @strList = COALESCE(@strList + ‘, ‘, ”) +
CAST(Name AS varchar(5))
FROM TABLE1

SELECT @strList
There are complex example in internet but you can [...]

How to parametrize OPENQUERY in MSSQL

How to parametrize OPENQUERY in MSSQL:
MSSQL has good feature of linked server between two different Database in same location or in remote location.
OPENQUERY helps you to execute your query in Linked server (remote) .
In linked server you can directly execute your query without OPENQUERY but the performance will be a issue.
As per my experience OPENQUERY [...]

Find All SQL Server Instance Running in Local Network

How to list all SQL Server Instance Running in Local Network:
Some time you need to see the List of other running SQL server on your network. It is so simple and easy to call from other application also.
See the example:
– ######### Query
EXEC master..xp_cmdshell ‘osql -L’

– ############ Result

NULL
Servers:
(local)
MAIL_SERVER
[...]