The Will Will Web | SQL Server 2005 如何複製資料庫
前幾天在開發專案的時候需要複製一個資料庫用來做測試,但之前每次都手動做備份、建立新資料庫、還原資料等動作還蠻費時的,因此心血來潮寫了一段「複製資料庫」的 T-SQL 幫我執行複製資料庫的工作,自己覺得還含蠻好用的,T-SQL 程式如下:
The Will Will Web | SQL Server 2005 如何複製資料庫
前幾天在開發專案的時候需要複製一個資料庫用來做測試,但之前每次都手動做備份、建立新資料庫、還原資料等動作還蠻費時的,因此心血來潮寫了一段「複製資料庫」的 T-SQL 幫我執行複製資料庫的工作,自己覺得還含蠻好用的,T-SQL 程式如下:
Cant Take My Eyes Of You Chords by Lauryn Hill @ Ultimate-Guitar.Com
Song: Can't Take My Eyes Off You Artist: Lauryn Hill Album: the Miseducation of Lauryn Hill Tabbed by Markus Ljungman (markusljungman@hotmail.com) (Put a capo on the third fret for album version) Chords used: D----------xx0232 Dmaj7/C#---x40222 D7/C-------x30212 G/B--------x20003 Gm/Bb------x10033 D/A--------x00232 Em/G-------322000 D/F#-------200232 Bm---------x24432 Em---------022000 A----------x02220 On the album, they just play D Dmaj7 D7... without changing the bass note, but i think it sounds much better if you do. Play the version you think sounds better Verse: <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> You're just too good to be true. <span style="color: rgb(0, 127, 191); cursor: pointer;">Dmaj7/C#</span> Can't take my eyes off you. <span style="color: rgb(0, 127, 191); cursor: pointer;">D7/C</span> You'd be like heaven to touch. <span style="color: rgb(0, 127, 191); cursor: pointer;">G/B</span> I wanna hold you so much. <span style="color: rgb(0, 127, 191); cursor: pointer;">Gm</span>/<span style="color: rgb(0, 127, 191); cursor: pointer;">Bb</span> At long last love has arrived. <span style="color: rgb(0, 127, 191); cursor: pointer;">D/A</span> And I thank God I'm alive. <span style="color: rgb(0, 127, 191); cursor: pointer;">Em/G</span> You're just too good to be true. <span style="color: rgb(0, 127, 191); cursor: pointer;">D/F#</span> Can't take my eyes off you. <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> Pardon the way that I stare. <span style="color: rgb(0, 127, 191); cursor: pointer;">Dmaj7/C#</span> There's nothing else to compare. <span style="color: rgb(0, 127, 191); cursor: pointer;">D7/C</span> The thought of you leaves me weak. <span style="color: rgb(0, 127, 191); cursor: pointer;">G/B</span> There are no words left to speak. <span style="color: rgb(0, 127, 191); cursor: pointer;">Gm</span>/<span style="color: rgb(0, 127, 191); cursor: pointer;">Bb</span> But if you feel like I feel. <span style="color: rgb(0, 127, 191); cursor: pointer;">D/A</span> please let me know that it's real. <span style="color: rgb(0, 127, 191); cursor: pointer;">Em/G</span> You're just too good to be true. <span style="color: rgb(0, 127, 191); cursor: pointer;">D/F#</span> Can't take my eyes off you. chorus: <span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Em</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">A</span> I need you baby if it's quite all right, <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Em</span> I need you baby to warm the lonely night I love you baby. <span style="color: rgb(0, 127, 191); cursor: pointer;">A</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span> Trust in me when I say: OK (It's OK..) <span style="color: rgb(0, 127, 191); cursor: pointer;">Em</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">A</span> Oh pretty baby, don't let me down, I pray. <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span> Oh pretty baby, now that I found you, stay. <span style="color: rgb(0, 127, 191); cursor: pointer;">Em</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">A</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span> <span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span> And let me love you, oh baby. Let me love you. Oh baby... Verse: You're just too good to be true. Can't take my eyes off you. You'd be like heaven to touch. I wanna hold you so much. At long last love has arrived. And I thank God I'm alive. You're just too good to be true. Can't take my eyes off you. (<span style="color: rgb(0, 127, 191); cursor: pointer;">Bm</span>, <span style="color: rgb(0, 127, 191); cursor: pointer;">Em</span>, <span style="color: rgb(0, 127, 191); cursor: pointer;">A</span>, <span style="color: rgb(0, 127, 191); cursor: pointer;">D</span>....) I need you baby, and if it's quite allright, I need you baby to warm the lonely night. I love you baby. Trust in me when I say: It's OK Oh pretty baby, don't let me down, I pray. Oh pretty baby, now that I've found you. Stay. And let me love you, oh baby Let me love you, oh baby I need you baby if it's quite allright... I love you baby you warm the lonely night. I need you baby. Trust in me when I say: It's OK Oh oh pretty baby, don't let me down I pray. <---- start fading here Oh pretty baby, now that I found you. Stay. And let me love you, oh baby. Let me love you ...
© 2009 Ultimate-Guitar.com or its affiliates. All rights reserved About | Help | Site Map | Link To Us | Tell A Friend | TOS | Privacy Policy | Advertis
hardBackup is a powerful solution for disk-based backup on windows systems. By utilizing well proven open source technologies like Dirvish, Rsync, Openssh and Cygwin, hardBackup can:* keep several images of backup in a rotating scheme
* represent identical files in different images by one single physical copy
* transfer only changes in files via secure channels
小煎的IT筆記本: SQL Server 找出所有資料表, 欄位, 欄位型態.
SQL Server 找出所有資料表, 欄位, 欄位型態.
SELECT dbo.sysobjects.name AS sTableName,
dbo.syscolumns.name AS sColumnsName,
dbo.syscolumns.prec AS iColumnsLength,
dbo.syscolumns.colorder AS iColumnsOrder,
dbo.systypes.name + " AS sColumnsType,
dbo.syscolumns.isnullable AS iIsNull
FROM dbo.sysobjects INNER JOIN
dbo.syscolumns ON dbo.sysobjects.id = dbo.syscolumns.id INNER JOIN
dbo.systypes ON dbo.syscolumns.xusertype = dbo.systypes.xusertype
WHERE (dbo.sysobjects.xtype = ‘U’)
and (dbo.systypes.name+" IN (‘varchar’, ‘char’) )
dynamic form
Ext.ux.MetaForm – A FormPanel configured by metadata received from server
Ext.ux.MetaForm – A FormPanel configured by metadata received from serverHi all,
I’ve run into need of a FormPanel that would be auto-configured by metadata received from server. As usually, I’ve written it; here is the first version:
This is html file I’ve used for testing:
USE AdventureWorks;
GO
/* Enable Stats and Auto Update */
— Enable Auto Create of Statistics
ALTER DATABASE AdventureWorks
SET AUTO_CREATE_STATISTICS ON;
— Enable Auto Update of Statistics
ALTER DATABASE AdventureWorks
SET AUTO_UPDATE_STATISTICS ON;
GO
— Update Statistics for whole database
EXEC sp_updatestats
GO
SQL Server日期函数集合_SQL Server_开发学院
–参考http://msdn.microsoft.com/zh-cn/library/ms186724.aspx
–1:获取系统日期和时间值函数
–getdate()
SELECT GETDATE() AS ‘today’
–getutcdate()
SELECT GETUTCDATE() AS ‘today’–2:修改日期和时间值函数
–dat
–参考http://msdn.microsoft.com/zh-cn/library/ms186724.aspx
–1:获取系统日期和时间值函数
–getdate()
SELECT GETDATE() AS ‘today’
–getutcdate()
SELECT GETUTCDATE() AS ‘today’–2:修改日期和时间值函数
–dateadd()
SELECT DATEADD(yy,10,GETDATE())
–获取当前天的前后五天日期:
select DATEADD(dd,5,GETDATE())
select DATEADD(dd,-5,GETDATE())
–2008? switchoffset
–SELECT SWITCHOFFSET (‘1998-09-20 7:45:50.71345 -5:00’, ‘-08:00’)
–2008? todatetimeoffset–3:获取日期和时间差函数
–datediff()
SELECT DATEDIFF(yy,’1984/5/3′,GETDATE())
–正常使用
SELECT DATEDIFF(HOUR,’1984/5/3′,GETDATE())
–转换成正数(负负得正)
SELECT DATEDIFF(MONTH,GETDATE(),’1984/5/3′)*-1–4:获取日期和时间部分的函数
–①datepart()返回表示指定date的指定datepart的整数:int
SELECT DATEPART(yy,GETDATE()),DATEPART(yyyy,GETDATE()) as ‘year’
SELECT DATEPART(mm,GETDATE()),DATEPART(m,GETDATE()) as ‘month’
SELECT DATEPART(dd,GETDATE()),DATEPART(d,GETDATE()) as ‘day’
SELECT DATEPART(hh,GETDATE()) as ‘Hour’
SELECT DATEPART(mi,GETDATE()),DATEPART(n,GETDATE()) as ‘minute’
SELECT DATEPART(ss,GETDATE()),DATEPART(s,GETDATE()) as ‘second’
SELECT DATEPART(ms,GETDATE()) as ‘millisecond’
–others
SELECT DATEPART(DW,GETDATE()),DATEPART(dw,GETDATE()),DATEPART(w,GETDATE()) as ‘weekday’–一周中的第几天
SELECT DATEPART(weekday, getdate() + @@DateFirst – 1)–中国星期算法中一周中的星期几
SELECT DATEPART(weekday, getdate() – 1)–中国星期算法中一周中的星期几
SELECT DATEPART(ww,GETDATE()),DATEPART(wk,GETDATE()) as ‘week’–?
SELECT DATEPART(dy,GETDATE()),DATEPART(y,GETDATE()) as ‘dayofyear’–一年中的第几天
SELECT DATEPART(qq,GETDATE()),DATEPART(q,GETDATE()) as ‘quarter’–季度
SELECT DATEPART(qq,’2010-03-21′),DATEPART(q,’2010-04-01′) as ‘quarter’
–年(yy),季(q),月(m),周(ww),时期(w),天(d),时(hh),分(n),秒(s)–②datename()返回表示指定日期的指定datepart的字符串:nvarchar
SELECT DATENAME(weekday,GETDATE())–星期三
SELECT DATENAME(WW, GETDATE())–?–③year(),相当于 datepart(yy,时间)
SELECT YEAR(GETDATE())–④month(),相当于datepart(mm,时间)
SELECT MONTH(GETDATE())–⑤day(),相当于datepart(dd,时间)
SELECT DAY(GETDATE())
SELECT DAY(‘1984/5/3’)–5:验证日期和时间值的函数
SELECT ISDATE(’04/15/2008′); –Returns 1.
SELECT ISDATE(’15/04/2008′); –Returns 0.–2008?
–SELECT CONVERT (date, GETDATE());
–SELECT CONVERT (time, GETDATE());
参数说明:日期部分
缩写
year
yy, yyyy
quarter
qq, q
month
mm, m
dayofyear
dy, y
day
dd, d
week
wk, ww
weekday
dw
Hour
hh
minute
mi, n
second
ss, s
millisecond
ms
Date 和 Time 样式
–语句及查询结果:
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE(), 1): 05/16/06
SELECT CONVERT(varchar(100), GETDATE(), 2): 06.05.16
SELECT CONVERT(varchar(100), GETDATE(), 3): 16/05/06
SELECT CONVERT(varchar(100), GETDATE(), 4): 16.05.06
SELECT CONVERT(varchar(100), GETDATE(), 5): 16-05-06
SELECT CONVERT(varchar(100), GETDATE(), 6): 16 05 06
SELECT CONVERT(varchar(100), GETDATE(), 7): 05 16, 06
SELECT CONVERT(varchar(100), GETDATE(), 8): 10:57:46
SELECT CONVERT(varchar(100), GETDATE(), 9): 05 16 2006 10:57:46:827AM
SELECT CONVERT(varchar(100), GETDATE(), 10): 05-16-06
SELECT CONVERT(varchar(100), GETDATE(), 11): 06/05/16
SELECT CONVERT(varchar(100), GETDATE(), 12): 060516
SELECT CONVERT(varchar(100), GETDATE(), 13): 16 05 2006 10:57:46:937
SELECT CONVERT(varchar(100), GETDATE(), 14): 10:57:46:967
SELECT CONVERT(varchar(100), GETDATE(), 20): 2006-05-16 10:57:47
SELECT CONVERT(varchar(100), GETDATE(), 21): 2006-05-16 10:57:47.157
SELECT CONVERT(varchar(100), GETDATE(), 22): 05/16/06 10:57:47 AM
SELECT CONVERT(varchar(100), GETDATE(), 23): 2006-05-16
SELECT CONVERT(varchar(100), GETDATE(), 24): 10:57:47
SELECT CONVERT(varchar(100), GETDATE(), 25): 2006-05-16 10:57:47.250
SELECT CONVERT(varchar(100), GETDATE(), 100): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE(), 101): 05/16/2006
SELECT CONVERT(varchar(100), GETDATE(), 102): 2006.05.16
SELECT CONVERT(varchar(100), GETDATE(), 103): 16/05/2006
SELECT CONVERT(varchar(100), GETDATE(), 104): 16.05.2006
SELECT CONVERT(varchar(100), GETDATE(), 105): 16-05-2006
SELECT CONVERT(varchar(100), GETDATE(), 106): 16 05 2006
SELECT CONVERT(varchar(100), GETDATE(), 107): 05 16, 2006
SELECT CONVERT(varchar(100), GETDATE(), 108): 10:57:49
SELECT CONVERT(varchar(100), GETDATE(), 109): 05 16 2006 10:57:49:437AM
SELECT CONVERT(varchar(100), GETDATE(), 110): 05-16-2006
SELECT CONVERT(varchar(100), GETDATE(), 111): 2006/05/16
SELECT CONVERT(varchar(100), GETDATE(), 112): 20060516
SELECT CONVERT(varchar(100), GETDATE(), 113): 16 05 2006 10:57:49:513
SELECT CONVERT(varchar(100), GETDATE(), 114): 10:57:49:547
SELECT CONVERT(varchar(100), GETDATE(), 120): 2006-05-16 10:57:49
SELECT CONVERT(varchar(100), GETDATE(), 121): 2006对上面进行动态生成字符串:
declare @sql1 nvarchar(200),@sql2 nvarchar(200)
declare @count nvarchar(100);
set @sql1 = ‘SELECT CONVERT(varchar(100), GETDATE(), 0)’
set @sql2 = ‘SELECT @count = CONVERT(varchar(100), GETDATE(), 0)’
exec sp_executesql @sql2,N’@count nvarchar(50) out’,@count out
print @sql1 +’:’+ @count–SQL Server 仅保证往返转换(即从原始数据类型进行转换后又返回原始数 据类型的转换)在各版本间产生相同值。
DECLARE @myval decimal (5, 2)
SET @myval = 193.57
SELECT CAST(CAST(@myval AS varbinary(20)) AS decimal(10,5))
— Or, using CONVERT
SELECT CONVERT(decimal(10,5), CONVERT(varbinary(20), @myval))
–输出193.57000
–输 出193.57000–bigint数据类型的字段截取(其它类型也一样)
select substring(CONVERT(varchar(15),字段名),11,9) from 表名
select substring(cast(字段名 as varchar(50),6,9)) from 表名不带世纪数位 (yy) (1) 带世纪数位 (yyyy) 标准 输入/输出 (3)
–
0 或 100 (1,2)
默 认
mon dd yyyy hh:miAM(或 PM)
1101
美 国
mm/dd/yyyy
2102
ANSI
yy.mm.dd
3103
英 国/法国
dd/mm/yyyy
4104
德 国
dd.mm.yy
5105
意 大利
dd-mm-yy
6106(1)
–
dd mon yy
7107(1)
–
mon dd, yy
8108
–
hh:mi:ss
–9 或 109 (1,2)
默 认设置 + 毫秒
mon dd yyyy hh:mi:ss:mmmAM(或 PM)
10110
美 国
mm-dd-yy
11111
日 本
yy/mm/dd
12112
ISO
yymmdd
yyyymmdd
–13 或 113 (1,2)
欧 洲默认设置 + 毫秒
dd mon yyyy hh:mi:ss:mmm(24h)
14114
–
hh:mi:ss:mmm(24h)
–20 或 120 (2)
ODBC 规范
yyyy-mm-dd hh:mi:ss(24h)
–21 或 121 (2)
ODBC 规范(带毫秒)
yyyy-mm-dd hh:mi:ss.mmm(24h)
–126 (4)
ISO8601
yyyy- mm-ddThh:mi:ss.mmm(无空格)
–127(6, 7)
带时区 Z 的 ISO8601。
yyyy-mm-ddThh:mi:ss.mmmZ
(无 空格)
–130 (1,2)
回历 (5)
dd mon yyyy hh:mi:ss:mmmAM
–131 (2)
回历 (5)
dd/mm/yy hh:mi:ss:mmmAM
java.net Forums : a BooleanPredicate for conditional …
a BooleanPredicate for conditional highlighting