locked
sql dml commands RRS feed

  • Question

  • Hi,

    how to create table, insert values in a table, update values in a table, delete values in a table .can u provide me commands in sql server ASAP

    thanks

    bnrao

    Friday, December 7, 2012 9:34 AM

Answers

  • ???

    what's about google?

    1. CREATE TABLE

    CREATE TABLE dbo.foo
    (
      ID INT NOT NULL,
      mytext char(20) NOT NULL,
    
      CONSTRAINT pk_foo PRIMARY KEY CLUSTERED (Id)
    );

    2. MANIPULATE DATA

    -- Insert data
    INSERT INTO dbo.foo
    (Id, mytext)
    VALUES
    (1, 'this is my text')
    
    -- Update data
    UPDATE dbo.foo
    SET    mytext = 'What a crap'
    WHERE  Id = 1;
    
    -- Delete data
    DELETE dbo.foo
    WHERE  Id = 1


    Uwe Ricken

    MCITP Database Administrator 2005
    MCITP Database Administrator 2008
    MCITP Microsoft SQL Server 2008, Database Development

    db Berater GmbH
    http://www-db-berater.de
    SQL Server Blog (german only)

    • Proposed as answer by Rama Udaya Friday, December 7, 2012 9:51 AM
    • Marked as answer by Allen Li - MSFT Thursday, December 13, 2012 1:22 AM
    Friday, December 7, 2012 9:40 AM

All replies

  • ???

    what's about google?

    1. CREATE TABLE

    CREATE TABLE dbo.foo
    (
      ID INT NOT NULL,
      mytext char(20) NOT NULL,
    
      CONSTRAINT pk_foo PRIMARY KEY CLUSTERED (Id)
    );

    2. MANIPULATE DATA

    -- Insert data
    INSERT INTO dbo.foo
    (Id, mytext)
    VALUES
    (1, 'this is my text')
    
    -- Update data
    UPDATE dbo.foo
    SET    mytext = 'What a crap'
    WHERE  Id = 1;
    
    -- Delete data
    DELETE dbo.foo
    WHERE  Id = 1


    Uwe Ricken

    MCITP Database Administrator 2005
    MCITP Database Administrator 2008
    MCITP Microsoft SQL Server 2008, Database Development

    db Berater GmbH
    http://www-db-berater.de
    SQL Server Blog (german only)

    • Proposed as answer by Rama Udaya Friday, December 7, 2012 9:51 AM
    • Marked as answer by Allen Li - MSFT Thursday, December 13, 2012 1:22 AM
    Friday, December 7, 2012 9:40 AM
  • Data Manipulation Language (DML) Statements (Transact-SQL)
    http://msdn.microsoft.com/en-us/library/ms177591%28v=sql.90%29.aspx

    other info
    ======
    http://databases.about.com/od/sql/a/sqlfundamentals_3.htm
    http://www.samplecodepool.com/forms/sqlserver/dml.aspx

    Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.

    Friday, December 7, 2012 9:50 AM