Sql server 数据库查询当前时间
–查询当前时间不带时分秒select convert(varchar(10),getdate(),23) –查询当前时间,带固定时间的时分秒select convert(varchar(10),getdate(),23)+” 00:00:00″–查询当前时间,带时分秒和毫秒数SELECT dateadd(d,-day(getdate())+1,getdate());–查询本月第一天起始时间
不怂!!
–查询当前时间不带时分秒select convert(varchar(10),getdate(),23) –查询当前时间,带固定时间的时分秒select convert(varchar(10),getdate(),23)+” 00:00:00″–查询当前时间,带时分秒和毫秒数SELECT dateadd(d,-day(getdate())+1,getdate());–查询本月第一天起始时间
–该写法是2008以下版本支持的INSERT INTO BillInfo (BillID, BID, IWtime, Storage)select “1”,1,”2012-11-19″,100 union allselect “2”,1,”2012-11-19″,100 union allselect “3”,1,”2012-11-19″,100 union allselect “4”,1
select name from syscolumns where id = object_id(“dt_GoodsSubWare”);
— 执行最慢的SQL语句SELECT (total_elapsed_time / execution_count)/1000 N”平均时间ms” ,total_elapsed_time/1000 N”总花费时间ms” ,total_worker_time/1000 N”所用的CPU总时间ms” ,total_physical_reads N”物理读取总次数” ,total_logical_rea
— 将创建的表赋值到一张临时表,然后取得临时表中的RowIDSELECT row_number() OVER (ORDER BY bt_ERPID ASC) AS RowID, * into #tFROM BAS_Stockgoupdate BAS_Stock set bt_ERPID=RowIDfrom BAS_Stock inner join #t on BAS_Stock.bt_No=
— set @str=”张三” 这里输入要查询的字符串declare @cloumns varchar(40)declare @tablename varchar(40)declare @str varchar(40)declare @counts intdeclare @sql nvarchar(2000)declare MyCursor Cursor For Select a.name as