SQL
sdluhaibing
就这么着!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
exec procedure every 5mins
while 1=1begin waitfor delay 00:05:00 exec Pinsertend原创 2009-08-06 09:35:00 · 433 阅读 · 0 评论 -
delete duplicate strings in different records
IF OBJECT_ID(tb) IS NOT NULLDROP TABLE tbGOCREATE TABLE tb( a varchar(30))goinsert tb SELECT 001,003,008 UNION ALL SELECT 003,008,019godeclare @s varchar(40)select @s=isnull(@原创 2009-08-05 11:01:00 · 370 阅读 · 0 评论 -
update the type of a field in many tables one time
DECLARE @fieldtype sysname SET @fieldtype=varchar --删除处理 DECLARE hCForEach CURSOR GLOBAL FOR SELECT Nupdate +QUOTENAME(o.name) +N set + QUOTENAME(c.name) + N = replace( + QU原创 2009-08-11 15:30:00 · 301 阅读 · 0 评论 -
Create table ,datetime field less than today
CREATE TABLE tb( ID INT IDENTITY NOT NULL, StartDateTime DATETIME, CONSTRAINT CHK_CONS_STARTDATETIME CHECK(StartDateTime < GETDATE()));原创 2009-08-10 09:14:00 · 387 阅读 · 0 评论 -
example of creating table
declare @tablea table (id int,[type] int,number int,area int,[power] int)insert into @tableaselect 1,1,23,78,98 union allselect 2,2,56,27,67 union allselect 3,3,21,34,23 union allselect 4,4原创 2009-08-21 11:12:00 · 324 阅读 · 0 评论 -
'union all' two select sentences contain 'order by'
declare @prod table (pid int, title varchar(30))insert into @prodselect 1,测试产品1 union allselect 2,测试产品2 union allselect 3,测试产品3 union allselect 4,测试产品4 union allselect 5,原创 2009-08-21 15:39:00 · 351 阅读 · 0 评论 -
convert date "2009-9-9 22:22:22" to "2009-9-9"
select convert(char(10),getdate(),120)原创 2009-12-01 16:16:00 · 557 阅读 · 0 评论
分享