|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: How To Use GO Command in "sqlcmd"?
Answer: "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 FYIcenter 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:
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 8020 users |
Added on |
9/23/2014 |
Views |
68828 |
Rate it! |
|
|
Question:
How To Use GO Command in "sqlcmd"?
Answer:
"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 FYIcenter 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: Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Happens to a Statement Batch If There Is a Compilation Error?
|
View Answer
|
|
What Is a Transact-SQL Statement Batch in MS SQL Server?
|
View Answer
|
|
How To Enter Comments in Transact-SQL Statements?
|
View Answer
|
|
How To Start and End Transact-SQL Statements?
|
View Answer
|
|
What Is a Transact-SQL Statement?
|
View Answer
|
|
What Is Transact-SQL Language?
|
View Answer
|
|
What Is SQL Language?
|
View Answer
|
|
Can Group Functions Be Used in the ORDER BY Clause in MS SQL Server?
|
View Answer
|
|
Can Multiple Columns Be Used in SQL GROUP BY Clause in MS SQL Server?
|
View Answer
|
|
How To Count Duplicated Values in a Column in MS SQL Server?
|
View Answer
|
|
How To Apply Filtering Criteria at Group Level with The HAVING Clause in MS SQL Server?
|
View Answer
|
|
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in MS SQL Server?
|
View Answer
|
|
Can Group Functions Be Mixed with Non-group Selection Fields in MS SQL Server?
|
View Answer
|
|
How To Use Group Functions in the SELECT Clause in MS SQL Server?
|
View Answer
|
|
What Are Group Functions in Query Statements in MS SQL Server?
|
View Answer
|
|
How To Filter Out Duplications in the Returning Rows in MS SQL Server?
|
View Answer
|
|
Can SELECT Statements Be Used on Views in MS SQL Server?
|
View Answer
|
|
How To Count Rows with the COUNT(*) Function in MS SQL Server?
|
View Answer
|
|
How To Sort Query Output in Descending Order in MS SQL Server?
|
View Answer
|
|
Can the Query Output Be Sorted by Multiple Columns in MS SQL Server?
|
View Answer
|