For all the database
select suser_sname(owner_sid) from sys.databases
For specific database
select suser_sname(owner_sid) from sys.databases where name = 'Northwind'
Tuesday, August 17, 2010
Update Multiple Column
MS SQL Update Multiple Column in single shot
*****************
UPDATE MyTable
SET (Col1, Col2, Col3, Col4) = (SELECT a, b, c, d FROM Mytable2 WHERE e =Mytable.Col5)
WHERE Col5 IN (SELECT d FROM Table2 )
*****************
*****************
UPDATE MyTable
SET (Col1, Col2, Col3, Col4) = (SELECT a, b, c, d FROM Mytable2 WHERE e =Mytable.Col5)
WHERE Col5 IN (SELECT d FROM Table2 )
*****************
Thursday, March 4, 2010
How to change SQL Server Instance Name?
Query current Instance Configuration
1. sp_helpserver
2. select @@servername
Execute the below query to change the instance name
1. sp_dropserver 'OldName'
2. go
3. sp_addserver 'NewName' , 'local'
4. go
Vefiry SQL Server Instance Config. by running following queries.
1. sp_helpserver
2. select @@servername
1. sp_helpserver
2. select @@servername
Execute the below query to change the instance name
1. sp_dropserver 'OldName'
2. go
3. sp_addserver 'NewName' , 'local'
4. go
Vefiry SQL Server Instance Config. by running following queries.
1. sp_helpserver
2. select @@servername
Subscribe to:
Posts (Atom)