SQL语句分享[不定期更新]

查询临时表

if object_id('')>0

查询表中的数据

select 'insert into ta1(col1,col2,col3) values('''+ltrim(列1)+''',''''+ltrim(列2)+''','''+ltrim(列3)+''')' from ta2

 

text 类型的用ltrim(cast([Content] as nvarchar(max)))

 删除重复的数据

delete t_news where   id   not   in( select min(id) from t_news  group by title)  

待更新

posted @ 2015-01-09 12:03  葡萄糖  阅读(156)  评论(0编辑  收藏  举报