随笔分类 - SQL Servcer
摘要:--第一种分页 SELECT * FROM ( select ROW_NUMBER() over(order by id) as rows,* from [dbo].[M_User] --WHERE Id>1 ) AS T where rows BETWEEN 0 AND 2 --第二种分页 需SQ
阅读全文
摘要:1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] if exists (select * from sys.databases where name =
阅读全文
摘要:--判断数据库是否有相关表 if exists (select 1 from sysobjects where id = object_id(' 表名 ') and type = ' U ' ); --判断数据库是否有相关字段 if exists (select 1 from syscolumns
阅读全文
摘要:--insert into pppcopy select * from ppp //从表ppp中获取数据,并将其插入到pppcopy中,只拷贝表的数据,不拷贝表的结构(前提:表pppcopy1存在) --select * into pppCopy1 from ppp //将ppp中的数据拷贝到 pp
阅读全文