Sliverlight学习日志(陈立东)

当你停下脚步的时候,想想有很多人还在继续奔跑~!Sliverlight
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

很牛的sql语句

Posted on 2009-09-29 15:40  陈立东  阅读(213)  评论(0)    收藏  举报

declare @begin_date as smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i as int select @i=0
while dateadd(hh,@i,@begin_date) < '07/27/2006 12:00:00'
begin
   select @i as code,dateadd(hh,@i,@begin_date) as jdate
   set @i=@i+1
end

declare @begin_date smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i int select @i=0
while dateadd(n,@i,@begin_date) < getdate()
begin
     select @i,dateadd(n,@i,@begin_date) jdate
     set @i=@i+30
end

SELECT * into #WSTtemp FROM OPENROWSET(
BULK '\\{FileServerIP}\test\test.xml' ,SINGLE_BLOB ) AS x
DECLARE @hdoc int
DECLARE @doc xml
select @doc=BulkColumn from #WSTtemp
EXEC sp_xml_preparedocument @hdoc OUTPUT,@doc
insert into Table_Name(A,B,C)
 SELECT * FROM OPENXML (@hdoc, '/ROOT/TIEM',3)
 with (A numeric(13,3), B numeric(13,3), C varchar(50))--这句一定要和DB中Table 的ColumnsName对应
exec sp_xml_removedocument @hdoc