Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in SQL by (4k points)

I need to alter a database using a batch file, for a simple example, drop a table. I´m using local SQL Express (SQL Server 2008 R2) with user sa and its password.

How would the bat file be?

How can I specify in the script the password and that I use in SQL Express?

1 Answer

0 votes
by (8.7k points)

It can be possible by using the sqlcmd utility as it helps in executing the SQL script from the command line.

The Syntax should be like this:

sqlcmd -U Login -P Password -S LMS -d D_B 

 -Q "DROP TABLE Student"


Related questions

Browse Categories