Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLCMD Missing Input File Name

Author  Topic 

dwagner
Starting Member

4 Posts

Posted - 2008-04-07 : 13:26:39
hello,
I am new to SQL sever and would like to connect to a particular database on the server using SQL. I have looked at various SQL sites with how to and none mention where I can locate the Input File name.

tprupsis
Yak Posting Veteran

88 Posts

Posted - 2008-04-07 : 14:14:17
When you connect to the server, you use the USE command to set the database:

c:> sqlcmd -S servername\instancename
1> USE AdventureWorks
2> GO
Changed database context to 'AdventureWorks'
Go to Top of Page

dwagner
Starting Member

4 Posts

Posted - 2008-04-07 : 14:17:37
It doesnt like the -S. it gives me a Invalid command line arg[2]: '-S'
Go to Top of Page

tprupsis
Yak Posting Veteran

88 Posts

Posted - 2008-04-07 : 14:28:40
Are you even trying to access a remote server? If not, you don't need that part. Issuing sqlcmd by itself will attempt to connect to the local default instance of SQL Server. If you are trying to get to a remote server, can you connect to the server using SQL Server Management Studio?
Go to Top of Page

dwagner
Starting Member

4 Posts

Posted - 2008-04-07 : 15:56:21
I'm not connecting to a remote server however I'd like to be able to work within SQL instead of the GUI so I can get some more experiance with using SQL statements
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2008-04-08 : 02:51:40
Just connect to your database using SQL Server Management Studio and click "new query". This will let you run plain sql statements from within the GUI.

--
Lumbago
Go to Top of Page

dwagner
Starting Member

4 Posts

Posted - 2008-04-09 : 14:50:49
Thanks, what I'm trying to do is create a sql script that will allow others to run the script and which will connect to a database and perform a search based off a global variable. Any suggestions?
Go to Top of Page
   

- Advertisement -