We can use sql query with interface or we can use it with command prompt, on this time i prefer to discuss from command prompt.
With interface, we can run it from :
With command prompt we can run it from
The script is like this :
For Window Authentication Login
sqlcmd -S server1\SQLExpress
For Account Authentication Login
sqlcmd -S server1\SQLExpress -U SqlUserAccount -P SqlPassword
Refer to SqlCmd utility – Case Sensitive format
And we can try for this useful scripts :
SqlCmd Help
sqlcmd /?
Execute query from file
sqlcmd -S myServer\instanceName -i C:\myScript.sql
Save query result on file
sqlcmd -S myServer\instanceName -i C:\myScript.sql -o C:\EmpAdds.txt
Reference Link
http://msdn.microsoft.com/en-us/library/ms165702.aspx
http://msdn.microsoft.com/en-us/library/ms170572.aspx
No comments:
Post a Comment