HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Are there any way to stop typing 'go' in sqlcmd?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
areanywaystoptypingsqlcmdthere

Problem

If I remember correctly, last time Microsoft Sqlcmd require each command to end with ';' and hit Enter key to execute the command.

However, currently, we need to type the GO each time to execute the command.

So, are there other alternative such that when we hit Enter key after ending the command with ';', it will Execute the command?

Solution

No, you need to type a batch separator. The default is GO. However, you can change that by using the -c switch.

For example:

C:\>sqlcmd -SServername -cFOO

1> select @@version

hit enter

2> FOO

hit enter

This will run.

Can't get rid of the intermediate enter for you. Sorry.

Context

StackExchange Database Administrators Q#23259, answer score: 8

Revisions (0)

No revisions yet.