Showing posts with label SQL Server. Show all posts
Showing posts with label SQL Server. Show all posts

Friday, November 8, 2019

Change Database default locations in SQL Server

Method 1: Change default database location via SQL Server Management Studio (SSMS):
Step 1. Right Click on Server and Select "Properties".



Step 2. in the "Server Properties" dialog box, navigate to "Database Settings" tab and data/log files location under "Database default locations" group.


 Step 3.  Click on "OK" to Save Changes.

Step 4.   As per Microsoft SQL Server Instance need to restart for to take effect. so Right Click on Server and Click on "Restart". It will prompt for confirmation - Press Yes. You can Restart Server Instance using Services.msc


Wednesday, December 7, 2011

How do you run a 300mb+ MS SQL .sql file?

From the command prompt, start up sqlcmd:

sqlcmd -S <server> -i C:\<your file here>.sql -o
Just replace with the location of your SQL box and with the name of your script. Don't forget if you're using a SQL instance the syntax is:
Here is the list of all arguments you can pass sqlcmd:
Sqlcmd            [-U login id]          [-P password]
  [-S server]            [-H hostname]          [-E trusted connection]
  [-d use database name] [-l login timeout]     [-t query timeout] 
  [-h headers]           [-s colseparator]      [-w screen width]
  [-a packetsize]        [-e echo input]        [-I Enable Quoted Identifiers]
  [-c cmdend]            [-L[c] list servers[clean output]]
  [-q "cmdline query"]   [-Q "cmdline query" and exit] 
  [-m errorlevel]        [-V severitylevel]     [-W remove trailing spaces]
  [-u unicode output]    [-r[0|1] msgs to stderr]
  [-i inputfile]         [-o outputfile]        [-z new password]
  [-f  | i:[,o:]] [-Z new password and exit] 
  [-k[1|2] remove[replace] control characters]
  [-y variable length type display width]
  [-Y fixed length type display width]
  [-p[1] print statistics[colon format]]
  [-R use client regional setting]
  [-b On error batch abort]
  [-v var = "value"...]  [-A dedicated admin connection]
  [-X[1] disable commands, startup script, enviroment variables [and exit]]
  [-x disable variable substitution]
  [-? show syntax summary]