Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

»ñÈ¡SQLServerµÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQLÓï¾ä

Ô­´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕǨÒÆÖÁ´Ë¡£
»ñÈ¡SQLServer
µÄ×îÍêÕûÊý¾Ý×ÖµäµÄSQL
Óï¾ä
 
ÆäʵÍøÉÏÒѾ­Á÷´«Á˺ܶà¹ØÓÚ»ñÈ¡
SQLServer
µÄÊý¾Ý×ÖµäµÄ°æ±¾£¬²»¹ýÎÒÏàÐÅÕâ¸öÓ¦¸ÃÊÇ×îÈ«µÄÁË£¬±¾Óï¾ä°üÀ¨ÁË±í¡¢×ֶΡ¢×Ö¶ÎÀàÐÍ¡¢×ֶγ¤¶È¡¢ÊÇ·ñΪ¿Õ¡¢ÊÇ·ñµÝÔö×ֶΡ¢Ë÷ÒýÃû³Æ¡¢Ë÷ÒýµÄ¶¨Î»¡¢Ë÷ÒýÀàÐÍ¡¢Ö÷¼ü¡¢Íâ¼üµÈ£»Í¨¹ýºÏÀíµÄ²Ã¼ô¿ÉÒԺܷ½±ãµÄÉú³ÉÏàÓ¦µÄÊý¾Ý×ֵ䡣
 
SELECT
sysobjects.name AS
±íÃû³Æ
,ITPUB¸öÈË¿Õ¼äqpd6Bv c~~ \0s%?7k(@
--sysproperties.[value] AS
±í˵Ã÷
,
Zqm6iAu:{6517
syscolumns.name AS
×Ö¶ÎÃû³Æ
,ITPUB¸öÈË¿Õ¼ä'y:q,dLc,d2b
--properties.[value] AS
×Ö¶Î˵Ã÷
,
ShKAM_p6517
systypes.name AS
×Ö¶ÎÀàÐÍ
,
:x-q
z$[X'n6517
syscolumns.length AS
×ֶ㤶È
,ITPUB¸öÈË¿Õ¼ä3g.O
h/o}t"t:[
ISNULL(COLUMNPROPERTY(syscolumns.id,
syscolumns.name,'Scale'), 0) AS
СÊýλÊý
,
CASE WHEN syscolumns.isnullable=0
bhvB-?6517
 THEN ''ITPUB¸öÈË¿Õ¼äut"t.a;w;uO*g
ELSE '

'ITPUB¸öÈË¿Õ¼ä)u(DZ)}�RM%M
END AS
ÊÇ·ñΪ¿Õ
,
0JH2l#K
g6_3G6517
CASE WHEN syscomments.text IS NULLITPUB¸öÈË¿Õ¼ä
S1s1~"?e\
G4}
 THEN '' ELSE syscomments.text
*@,f9}4Hi
n[aNN6517
END AS
ȱʡֵ
,ITPUB¸öÈË¿Õ¼ä
x;e){H^Y
CASE WHEN COLUMNPROPERTY(syscolumns.id,
syscolumns.name, 'IsIdentity')= 1
#U/v4i5]5Q"b6517
 THEN '

' ELSE ''
Ds(~E7] D5}6517
END AS
µÝÔö×Ö¶Î
,
2xB
kOPva(m'I6517
CASE WHEN sysindexes.name IS NULL
5H H2Y!l6^U4f,o6517
 THEN ''
;Pls)[|(PegV'~\�p6517
ELSE sysindexes.nameITPUB¸öÈË¿Õ¼ä7d#]\6~?,UXh
END AS
Ë÷ÒýÃû³Æ
,ITPUB¸öÈË¿Õ¼ä�h BP+l4u N#j
CASE WHEN sysindexkeys.keyno IS NULL
T|q2dN D eY*U+^*|0U6517
 THEN ''ITPUB¸öÈË¿Õ¼ä]X5FdH0V)K
ELSE
CONVERT(VARCHAR(10),sysindexkeys.keyno )
tk&]u
[P m6517
END AS
Ë÷ÒýλÖÃ
,
~'l4qDj5~ Z6517
CASE WHEN sysindexes.indid=1ITPUB¸öÈË¿Õ¼äs!v {]6u"Rw*S
 THEN '
¾Û¼¯Ë÷Òý
'
.kaIn1bCR�j6517
WHEN sysindexes.indid>1 AND sysindexes


Ïà¹ØÎĵµ£º

SQLServer´óÊý¾ÝÁ¿²åÈëBULK INSERT


SQLSERVER ´óÊý¾ÝÁ¿²åÈëÃüÁ
BULK INSERTÊÇSQLSERVERÖÐÌṩµÄÒ»Ìõ´óÊý¾ÝÁ¿µ¼ÈëµÄÃüÁËüÔËÓÃDTS(SSIS)µ¼ÈëÔ­Àí£¬¿ÉÒÔ´Ó±¾µØ»òÔ¶³Ì·þÎñÆ÷ÉÏÅúÁ¿µ¼ÈëÊý¾Ý¿â»òÎļþÊý¾Ý¡£ÅúÁ¿²åÈëÊÇÒ»¸ö¶ÀÁ¢µÄ²Ù×÷£¬ÓŵãÊÇЧÂʷdz£¸ß¡£È±µãÊdzöÏÖÎÊÌâºó²»¿ÉÒԻعö¡£
¡¡¡¡BULK INSERTÊÇÓÃÀ´½«ÍⲿÎļþÒÔÒ»ÖÖÌض¨µÄ¸ñʽ¼ÓÔ ......

java µ÷ÓÃͨÓô洢¹ý³Ì£¨Sqlserver£©


package com.wfy.system.dao;   
  
import java.sql.CallableStatement;   
import java.sql.Connection;   
import java.sql.ResultSet;   
import java.sql.SQLException;   
import java.sql.Types;    ......

sqlserver µÄprepare·½·¨Ê¹ÓÃÎÊÌâ

1.Èç¹ûÏÈprepare ºóÌí¼Ó²ÎÊý£¬ÕâÑùÒ»²¿·ÖÊý¾ÝÀàÐÍ¿ÉÒÔ²»ÓÃÉèÖÃÆäsize´óС£¬ÀýÈçchar
2.Èç¹ûÏÈÌí¼Ó²ÎÊýÔÙprepare£¬¾Í±ØÐëÉèÖòÎÊýµÄÀàÐÍ£¬´óС£¬¾«¶È²ÅÄÜͨ¹ý£¬±ÈÈçchar,varchar,decimalÀàÐÍ£¬¶øint,floatÓй̶¨×Ö½ÚÀàÐ͵ÄÊý¾ÝÀàÐÍÔò¿É²»ÓÃÉèÖôóС¡£
3.¹ØÓÚSqlServerµÄtimestampÀàÐÍ£º¸ÃÀàÐÍΪSqlServerµÄʱ¼ä´ÁÀàÐÍ£¬´´½ ......

sqlserver×Ö·û´®²ð·Ö(split)·½·¨»ã×Ü

sqlserver×Ö·û´®²ð·Ö(split)·½·¨»ã×Ü
--·½·¨0£º¶¯Ì¬SQL·¨
declare @s varchar(100),@sql varchar(1000)
set @s='1,2,3,4,5,6,7,8,9,10'
set @sql='select col='''+ replace(@s,',',''' union all select ''')+''''
PRINT @sql
exec (@sql)
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ ......

SqlServerÓαêʾÀý

declare @areaid varchar(100)
declare @areaname varchar(100)
declare Cur cursor  for
select code as areaID,[name] as areaName  from dbo.province
open Cur
Fetch next from Cur Into @areaid,@areaname
While @@fetch_status=0   
Begin
    print('insert into ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ