I want to insert data from an .sql file to my table in SQL. And all that with CMD.
My file contains that line:
INSERT INTO MYTABLE
VALUES (1, 2, 25, 'AK00008GP005L', '2008-04-19 11:31:00', '000', 1, 239.97, NULL, 'GH783MF', NULL, NULL);
It is possible?
Thanks.
You can use SQLCMD
(as suggested by Sibster). Assuming the file containing the query is called insert.sql
, the command in its simplest form (using NT authentication) would look something like:
sqlcmd -S <servername> -E -d <dbname - TRY> -i insert.sql
To use SQL authentication:
sqlcmd -S <servername> -U <username> -P <password> -d <dbname - TRY> -i insert.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With