SQL Command needed ASAP

  • I have a SQL database name company and a table named users, what SQL command would I run to get a list of the contents of that table?

  • eba.seller (2/25/2012)


    I have a SQL database name company and a table named users, what SQL command would I run to get a list of the contents of that table?

    i may be having trouble reading your question, it seems like the most basic of SQL questions.

    are you looking for something like this?:

    SELECT * FROM Company.dbo.Users

    --or

    SELECT * FROM Company..Users

    --Company is the database name

    --dbo is the schema, leaving it out defaults to dbo

    --Users is the table name.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • eba.seller (2/25/2012)


    I have a SQL database name company and a table named users, what SQL command would I run to get a list of the contents of that table?

    use company

    SELECT * FROM table

    Syntax:

    USE <DatabaseName>

    SELECT * FROM <TableName>

    You can put a search over the internet (or at "http://social.msdn.microsoft.com" ) with phrase "Microsoft SQL Server"

  • I'd suggest picking up a copy of Itzik Ben-Gan's excellent book, TSQL Query Fundamentals

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply