打不死的心态活到老。

Sqlserver2000造数据

上一篇 / 下一篇  2007-08-01 00:08:33 / 个人分类:数据库

xT7^|0Q Ba0 51Testing软件测试网t?%s-v_,u_/I;pk

@AX*V7Y~0F0Sqlserver2000建表语句

%j+T%f emql0

'l7s q8z0o*S8h \0if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TestVar]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

+Xut*avk H(Y0

9NI{Am5e0drop table [dbo].[TestVar]

&Y)vd4Dt2D.RaqN0

wgRN5_t0GO51Testing软件测试网#nY,a.^/U\ f

;F1i&c*W x5M0 51Testing软件测试网 `;qwa"a(C9U,m

51Testing软件测试网\rr8}Si r&u%y.QPU

CREATE TABLE [dbo].[TestVar] (51Testing软件测试网O~T*k6wL

51Testing软件测试网Y8c"R)~t^gsE

[aInt] [int] IDENTITY (1, 1) NOT NULL ,

uPS6A6l6{}8OBXo N0

*[%jzr n{;P_^N4P0[aBigint] [bigint] NULL ,51Testing软件测试网:K o6P)~` @3x

fFgxBHXK y0[aBinnary] [binary] (50) NULL ,

$d2L/t1r*~051Testing软件测试网!B1WU(h4m/[6m'n9f

[aBit] [bit] NULL ,51Testing软件测试网!GH%p#X2yG R

7K\5jFpf3p OwI.Q0[aChar] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,

h)WxF'er/M"A.\%el051Testing软件测试网sCB@.gD

[aDatetime] [datetime] NULL ,

0M;H S8? E0Ici051Testing软件测试网#k1P k~i'J*P*BF.MG

[aDecimal] [decimal](18, 0) NULL ,51Testing软件测试网;pEGNP0YxrVP.o

sSV&]JP;d7}z V0[aFloat] [float] NULL ,51Testing软件测试网A&B1v1W(`

0Z IR"z U3m?0[aImage] [image] NULL ,

5Y U1R[+pY/x0

,k]edu Ml^/dz0[aMoney] [money] NULL ,51Testing软件测试网6C)L K [,zoEJ

7H7Y }0@|(\Y:i0[aNChar] [nchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,51Testing软件测试网/MN0KImk"a

51Testing软件测试网z.tF8\:XFji

[aNText] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,51Testing软件测试网]h ]gN U

51Testing软件测试网*S+_"YwtqW s

[aNumeric] [numeric](18, 0) NULL ,51Testing软件测试网@6Zs;n5^'h.R-s

'zZ6|O"A1sOTi0[aNvarchar] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,51Testing软件测试网hF{(R)[ a^Le

3S3x;Q_"[,Y0[aReal] [real] NULL ,

|T$RGiqhn051Testing软件测试网;i Rt { q/?(m[5RG

[aSmalldatetime] [smalldatetime] NULL ,

U7kL~#LBeMv0`051Testing软件测试网 `"\*F.x%Q!y h|6y

[aSmallInt] [smallint] NULL ,

jVRO])v051Testing软件测试网4BC#R[!FaI

[aSmallMoney] [smallmoney] NULL ,

koq,Dz*M\F4m4pQ051Testing软件测试网-?pl;R _3Mg/A*b|

[aSql_Variant] [sql_variant] NULL ,

+g(a)Zii#S%T8d!C051Testing软件测试网ExhU m'a[B0@7I

[aText] [text] COLLATE Chinese_PRC_CI_AS NULL ,

:s iCm;i0

x I]Q$TB0[aTimesTamp] [timestamp] NULL ,

eD"PEL0

MwJ(t_$w'K5s%D0[aTinYint] [tinyint] NULL ,51Testing软件测试网h oA4M!w{6E0o3Q

51Testing软件测试网k Lkyn [6r

[aUniQueidentifier] [uniqueidentifier] NULL ,

1L{+n+g:uim[P.h R)n051Testing软件测试网i Q1v;D;bgU

[aVarBinary] [varbinary] (50) NULL ,

([mK W)~[r0

k\"w%v0hJ&l0[aVarchar] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL

s7k)Z;N-M051Testing软件测试网AiX._(?2?

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]51Testing软件测试网}%ol&~'r|Q:qu

y.L)Q0Cy!L~ e:P0GO51Testing软件测试网 _z4hF-J j2L

6b`U(};SxE!x0s0 51Testing软件测试网,Vh,C;g mR^vo1J

*_4u8h$|+gaBN0b"w0 51Testing软件测试网 oX |^*Y$Y#owq9E EDQ

0H i;c0R0ii7ii"I9^RC0插入1条记录示例

I;{*FS6V!]P0

(n c!@]Oh%MYC0INSERT INTO51Testing软件测试网*h\6P9r7sx7]9s

51Testing软件测试网%h~h)s0|

[testBase].[dbo].[TestVar]( [aBigint],51Testing软件测试网HF,XYQ(l0J.{i&K

)SS |5e _N:J,O5c'}g0 [aBinnary], [aBit], [aChar], [aDatetime],51Testing软件测试网7n,H|+T$vR/o;]

6ze6FBT$Op_0[aDecimal], [aFloat], [aImage], [aMoney],51Testing软件测试网Mnr'A)e p

#T r:\(P4k]1Oz0[aNChar], [aNText], [aNumeric], [aNvarchar],51Testing软件测试网)cA0W#^afB/RC

h kib V0 [aReal], [aSmalldatetime], [aSmallInt], [aSmallMoney],

hS)~p[$K-[,l0

[s@6y@Q'T0[aSql_Variant], [aText],51Testing软件测试网+T4UYga$LW%` D

51Testing软件测试网ec.e6zV9JD

 [aTinYint], [aUniQueidentifier], [aVarBinary], [aVarchar])

hS;P}EK)sj0

&H}d B"AYB`0VALUES( 1,51Testing软件测试网$L:B&|4`F)U:E&u;_'fY

51Testing软件测试网}6\Ic`9t4yT

 CAST( 123456 AS BINARY(4) ), '0101', 'aChar', getdate(),51Testing软件测试网!W3@+uo0z1f(HJc-L

M@4d,nhdxF?0 132.00, 123.00,'abcdefghijk' , 123.00,51Testing软件测试网8O3K2HY&\?O

S9_c T$l9Q5z]0'aNChar', 'aNText,ntext,>', 12300.00,'<aNvarchar,nvarchar(50),>',

He5Z iTd051Testing软件测试网ioM [Gi\

CAST(300 AS real) , getdate(), 123.123, 123.00,51Testing软件测试网-Trx&lA}y.P0t7rn z"\

51Testing软件测试网nEPd X$xPw

convert(nchar(20), N'AbCdEfGhIjKlMnOpQrStUvWxYz'), '<aText,text,>',

:v NbB.Vgt051Testing软件测试网h L8WO p| yh

 51Testing软件测试网'ID_-k q$m+_1|

+{*Wn4~4?0CAST(3 AS TinYint),NEWID() , CAST( REPLICATE( 0x20, 128 ) AS varbinary(32) ),

V r!l-W'_2|?,T3x `*K051Testing软件测试网YDOQ5j1yqU

'<aVarchar,varchar(50),>')51Testing软件测试网B qh;tuc^

51Testing软件测试网0}opBv(b#zJb

 51Testing软件测试网nV(p'n s7L8T\Jj

i zGCD.][]\0循环插入10000条数据示例51Testing软件测试网8l \,V%iv;B

cO`*B*wR@^;d0While (select Count(*) from  TestVar)<10000

]B/l3Oq1LS*Z0

;^6S^ j{C0begin51Testing软件测试网'd a3H/x%}Q2ZZ+t

51Testing软件测试网2^1qMhu*K@

INSERT INTO [testBase].[dbo].[TestVar]( [aBigint],

E.w"Rw-_ LbE051Testing软件测试网\ h,`3E1x

 [aBinnary], [aBit], [aChar], [aDatetime],51Testing软件测试网(Eyn0q)IL1l

51Testing软件测试网+_H'tUy%~l

[aDecimal], [aFloat], [aImage], [aMoney],

\ uQ7o(tQX051Testing软件测试网*p8wN$Jg!a

[aNChar], [aNText], [aNumeric], [aNvarchar],

:LD9b,U7~051Testing软件测试网6k0N-_KoCwjQ/Q%q v

 [aReal], [aSmalldatetime], [aSmallInt], [aSmallMoney],

.`rR:Ftd g g0

YF_&g7G|%D0[aSql_Variant], [aText],51Testing软件测试网b/ghq;|] s

:^[rW6O1dx1Q h0 [aTinYint], [aUniQueidentifier], [aVarBinary], [aVarchar])51Testing软件测试网,L+]K7X.w VgE

Om&E6Zc-Low:s0VALUES( 1, CAST( 123456 AS BINARY(4) ), '0101', 'aChar', getdate(),51Testing软件测试网+qC uv2n7rm@3{

51Testing软件测试网r"f d9q!~u

 132.00, 123.00,'abcdefghijk' , 123.00,51Testing软件测试网 k*? P/G Y e+v^

,Ikf%xm4E$Sz.U0'aNChar', 'aNText,ntext,>', 12300.00,'<aNvarchar,nvarchar(50),>',51Testing软件测试网,p\qA [F)]ys

T O]"Y3F4r }k0CAST(300 AS real) , getdate(), 123.123, 123.00,51Testing软件测试网JR6_ B.N,F3}]9jM

51Testing软件测试网,X&q.HT La(Y

convert(nchar(20), N'AbCdEfGhIjKlMnOpQrStUvWxYz'), '<aText,text,>',

~2@r*p8X0

*`;v3Qu} g{9b)r2? Q0CAST(3 AS TinYint),NEWID() , CAST( REPLICATE( 0x20, 128 ) AS varbinary(32) ),51Testing软件测试网ShzI u q [A

51Testing软件测试网,M}^iW"C

'<aVarchar,varchar(50),>')

4u0yF6\ OT }9h051Testing软件测试网5BV j;P@p0M!?3~^(F

CONTINUE51Testing软件测试网g!To4V \T

~;tl;[ykY0End51Testing软件测试网4C4CY+qW4Y&zV


TAG: 数据库

 

评分:0

我来说两句

Open Toolbar