|
|
-
|
|
We can backup a SQL Server database to a mapped drive using the following script
1) First it will create Map Drive in Local PC2) Backup the Database.3) Delete the Map Drive, so that next time the same script can be used.
EXEC master..xp_cmdshell 'net use z: "\\192.168.1.93\share" password /user:......
|
|
-
|
|
We can use this script to show the row data in string.
Name
------
RAM
SHYAM
HARI
RITA
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 ......
|
|
-
|
|
Few days back I was trying to send sql data to my web API using Store-procedure and it was simple and interesting, you can use the same way to call web http
post or get both method using such way
CREATE function [dbo].[HttpGetMethod]
(
@url varchar(8000)
)
returns varchar(8000)as
BEGIN
D......
|
|
-
|
|
Cross tab result is always required and it is bit complex in case of dynamic column.
If column name has to be dynamic then this is the good idea to have the PIVOT Query,
for example I have 3 Tables and data like this:
First Table
------------------------------------------......
|
|