1、查詢時把兩個字段拼接在一起
--sqlserver-- select Filed1+'@'+Filed2 from table --sqlite-- select Filed1||'@'||Filed2 from table
2、使用腳本添加字段,更改字段類型,刪除字段
--------添加字段---------- --sqlserver-- IF not exists (select * from syscolumns where id=object_id('表名') and name='字段') BEGIN alter table 表名 add 字段 int end --sqlite-- alter table 表名 add 字段 int --------更改字段類型---------- --sqlserver-- alter table table alter column filed nvarchar(256) --sqlite中需要把舊表重命名,創建新表(這個時候更改字段類型),然后再把數據導入到新表中,刪除舊表-- ALTER TABLE 表名 RENAME TO "重命名" Create TABLE "表名"( [Id] bigint NOT NULL ,[Name] nvarchar(16) , Primary Key(Id) ) Insert Into '重命名' ([Id],[Name]) Select [Id],[Name] From MAIN.['表名'] Drop Table MAIN.[重命名表]
3、取前幾條數據
--sqlsever-- SELECT TOP 10 * FROM table ORDER BY filed DESC --sqlite-- select * from table limit 0,10
4、判斷插入數據
--sqlserver-- IF NOT EXISTS (select * from table where FID=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 where FID=6 )