![]() There are some situations where the semicolon is mandatory like in some CTE However, the semicolon is used to separate statements and the GO command is for batches. In many scenarios, you can use a semicolon or the GO command. Without the GO, the query will not be executed.īy default, the number of times is 1 and it is usually used just to separate batches while the number of times feature, is not frequently used.ĭifferences between the semicolon and the SQL Go command The query requires a GO at the end to inform to sqlcmd that In the command line, you need to use GO because that way, you know that the T-SQL statement ended and you know that you can execute it.įor example, this T-SQL query will show the databases. SQL Server utilities you probably didn’t know about – SQLdiag, osql and SqlLocalDB (osql is in the middle of the article).If you want to know a little more about osql, refer to this link: In the command-line write osql -E to login: Working with the SQL Server command line (sqlcmd).Then you can write sentences with the GO command which is mandatory.įor more information about SQLCMD, refer to my other article below: To connect to sqlcmd you have to go to the command line and to enter with your windows credentials use the sqlcmd -EĬommand. Server and osql is an old version of SQLCMD that may be removed someday). Recognized by native SQL Server tools like the SSMS, the SQLCMD, and OSQL (SQLCMD is the command-line to handle SQL It is not a T-SQL statement, but it is a command ![]() The GO command is frequently used inside T-SQL code to use batches. Several system procedures from Sybase and after some years, it changed a lot with new different features, but the GO statement was one of the main commands in Sybase inherited by SQL Server and it is still used today. SQL Server was based on the Sybase database (an old database system deprecated in 2014). In this article, we will explain what the SQL GO command is when to use it, and some tips about using it. If you are using SQL Server and saw a GO command in a T-SQL script and you do not know what that GO is used for,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |