Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hate to sound like an idiot but

Status
Not open for further replies.

mccdo

Technical User
Aug 28, 2002
3
US
could someone please explain to me using the word "USE" in a query statement?
 
Actually, I am still learning about SQL and I was reading an example as follows:

USE tempdb
GO
SET NOCOUNT ON
CREATE TABLE #testts (c1 int identity, c2 int DEFAULT 0, changelog timestamp)

INSERT #testts DEFAULT VALUES

And the example query continues...........

It's the first part, where the "USE tempdb" is located. Since reading about this and from the examples, I would assume this would have something to do with creating a table, except that nowhere can I find an explanation about why the word "USE" is used in a query.

I hope this makes more sense.
 
syntax: use <database>

This changes the current database you are working in.

(SQL Server, MySQL, not sure which others) codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Yes, I am working on SQL Server. I thank you for the info. I had seen this before in different queries but did not know it's exact usage. Thank you again.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top