Thursday, 24 July 2014

How to changing default collation of SQL Server



image

1. Now open command prompt as Administrator user and navigate to the Setup.exe on installation media or local copy of setup.exe. In default installation setting; you’ll find this file here: (ตำแหน่งของไฟล์ Setup โปรแกรม SQL Server)
image

2. Next the command you want to run has following syntax:
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=<Your Instance Name> /SQLSYSADMINACCOUNTS=<Your SQL SYS Admin account> [ /SAPWD=<Password> ] /SQLCOLLATION=<Your New SQL Collation name>

Ex. setup /QUIET /ACTION=RebuildDatabase /INSTANCENAME=”SQLEXPRESS” /SAPWD=”password user sa” /SQLCOLLATION=”SQL_Latin1_General_CP1_CI_AS” /SQLSYSADMINACCOUNTS=”user admin on PC”

3. Hit enter and you are done.


URL : http://www.carryoverbit.com/changing-default-collation-of-microsoft-sql-server-2012/

Tuesday, 15 July 2014

Linked Server

 

Linked Server in SQL Server Management Studio.

image

 

Ex. Select Query

select * from [SAPDEV]..[SAPDEV].[ZHST_MID]

 

Ex. Insert Query

INSERT into  OPENQUERY (SAPDEV, 'select * from SAPDEV.ZHST_MID')
values ('210','M002','Test','TT',' ',' ',' ')

INSERT OPENQUERY (OracleSvr, 'SELECT name FROM joe.titles')
VALUES ('NewTitle')
 
Ex. Update Query

UPDATE OPENQUERY (OracleSvr, 'SELECT name FROM joe.titles WHERE id = 101') 
SET name = 'ADifferentName'
 
Ex. Delete Query

DELETE OPENQUERY (OracleSvr, 'SELECT name FROM joe.titles WHERE name = ''NewTitle''')