SQLite differs from SQL Server

Source: Internet
Author: User

1, the query when the two fields are stitched together

-- sqlserver-- Select Filed1+'@'+fromtable--sqlite--  Select Filed1| | ' @ ' ||  from Table


2. Add a field using a script, change the field type, delete a field

--------Add fields------------sqlserver--IF  not exists     (Select *  fromsyscolumnswhereId=object_id('Table name') andName='Field')BEGIN    Alter TableTable nameAddFieldintEnd--sqlite--Alter TableTable nameAddFieldint--------Change the field type------------sqlserver--Alter Table Table Alter columnFilednvarchar( the)--SQLite needs to rename the old table, create a new table (this time change the field type), and then import the data into the new table, delete the old table--ALTER TABLETable name RENAME to"Rename"Create TABLE"Table name" ([Id] bigint  not NULL,[Name] nvarchar( -) , Primary Key(Id))Insert  into ' Renaming'([Id],[Name])Select [Id],[Name]  fromMAIN.[' table name ']Drop TableMAIN.[Renaming a table]

3. Take the first few data

  

-- sqlsever-- SELECT TOP Ten *  from Table ORDER  by DESC -- sqlite-- Select *  from Table 0,ten

4. Determine the insertion data
  

  

--sqlserver--IF  not EXISTS(Select *  from Table whereFID=6)  BEGIN Insert  into Table(Fname,fisdelete)Select 'T',0 END--sqlite--Insert  into Table(Fname,fisdelete)Select 'TT',0 where  not exists(Select *  from Table whereFID=6)

SQLite differs from SQL Server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.