How To Use GO Command in "sqlcmd"?
Submitted by: Administrator"sqlcmd" is a command line client application to run Transact-SQL statements on a target SQL Server. When "sqlcmd" is started and connected to a SQL Server, it will start a new batch and prompt you to enter the first statement of the batch. You can enter one or more statements in one or more lines to form a Transact-SQL statement batch. To end a batch of statements and send it to the SQL Server for execution, you need to enter the GO command. The following "sqlcmd" tutorial session sends two batches to the SQL Server:
C:>sqlcmd -S localhostsqlexpress -U sa -P GlobalGuideline
1> SELECT getdate();
2> SELECT getdates();
3> SELECT getdate();
4> GO
Msg 195, Level 15, State 10, Line 2
'getdates' is not a recognized built-in function name.
1> SELECT getdate();
2> SELECT getdate();
3> SELECT getdate();
4> GO
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
1>QUIT
C:
Submitted by: Administrator
C:>sqlcmd -S localhostsqlexpress -U sa -P GlobalGuideline
1> SELECT getdate();
2> SELECT getdates();
3> SELECT getdate();
4> GO
Msg 195, Level 15, State 10, Line 2
'getdates' is not a recognized built-in function name.
1> SELECT getdate();
2> SELECT getdate();
3> SELECT getdate();
4> GO
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
-----------------------
2007-05-19 22:55:07.233
(1 rows affected)
1>QUIT
C:
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | What Is a Subquery in a SELECT Query Statement in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Configure and Test ODBC DSN Settings? |
☺ | How To Use UNION to Merge Outputs from Two Queries Together in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |