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

Sqlserver ÖÐÁÙʱ±íºÍÈ«¾ÖÁÙʱ±í

SQL Server Ö§³ÖÁÙʱ±í¡£ÁÙʱ±í¾ÍÊÇÄÇЩÃû³ÆÒÔ¾®ºÅ (#) ¿ªÍ·µÄ±í¡£Èç¹ûµ±Óû§¶Ï¿ªÁ¬½ÓʱûÓгýÈ¥ÁÙʱ±í£¬SQL Server ½«×Ô¶¯³ýÈ¥ÁÙʱ±í¡£ÁÙʱ±í²»´æ´¢ÔÚµ±Ç°Êý¾Ý¿âÄÚ£¬¶øÊÇ´æ´¢ÔÚϵͳÊý¾Ý¿â tempdb ÄÚ¡£
ÁÙʱ±íÓÐÁ½ÖÖÀàÐÍ£º 
±¾µØÁÙʱ±í 
ÒÔÒ»¸ö¾®ºÅ (#) ¿ªÍ·µÄÄÇЩ±íÃû¡£Ö»ÓÐÔÚ´´½¨±¾µØÁÙʱ±íµÄÁ¬½ÓÉϲÅÄÜ¿´µ½ÕâЩ±í¡£
È«¾ÖÁÙʱ±í 
ÒÔÁ½¸ö¾®ºÅ (##) ¿ªÍ·µÄÄÇЩ±íÃû¡£ÔÚËùÓÐÁ¬½ÓÉ϶¼ÄÜ¿´µ½È«¾ÖÁÙʱ±í¡£Èç¹ûÔÚ´´½¨È«¾ÖÁÙʱ±íµÄÁ¬½Ó¶Ï¿ªÇ°Ã»ÓÐÏÔʽµØ³ýÈ¥ÕâЩ±í£¬ÄÇôֻҪËùÓÐÆäËüÈÎÎñÍ£Ö¹ÒýÓÃËüÃÇ£¬ÕâЩ±í¼´±»³ýÈ¥¡£µ±´´½¨È«¾ÖÁÙʱ±íµÄÁ¬½Ó¶Ï¿ªºó£¬ÐµÄÈÎÎñ²»ÄÜÔÙÒýÓÃËüÃÇ¡£µ±Ç°µÄÓï¾äÒ»Ö´ÐÐÍ꣬ÈÎÎñÓë±íÖ®¼äµÄ¹ØÁª¼´±»³ýÈ¥£»Òò´Ëͨ³£Çé¿öÏ£¬Ö»Òª´´½¨È«¾ÖÁÙʱ±íµÄÁ¬½Ó¶Ï¿ª£¬È«¾ÖÁÙʱ±í¼´±»³ýÈ¥¡£
==========================================================================
SQL code
--Ó¦Óñ¾µØÁÙʱ±í
declare @sql varchar(100)
set @sql='select ''123'' as a,''abasdf'' as b into #t'
exec(@sql)
select * from #t
go
/*·¢ÏÖ²»ÄÜÕýÈ·ÏÔʾÁÙʱ±íµÄÊý¾Ý
Ìáʾ£º
·þÎñÆ÷: ÏûÏ¢ 208£¬¼¶±ð 16£¬×´Ì¬ 1£¬ÐÐ 5
¶ÔÏóÃû '#t' ÎÞЧ¡£
*/
--ÐÞ¸ÄΪȫ¾ÖÁÙʱ±í
declare @sql varchar(100)
set @sql='select ''123'' as a,''abasdf'' as b into ##t'
exec(@sql)
select * from ##t
drop table ##t
go
/*¿ÉÒÔÕýÈ·ÏÔʾÁÙʱ±íµÄÊý¾Ý
·ÖÎöÔ­Òò:exec(@sql) Ï൱ÓÚÖØн¨Á¢Ò»¸öÊý¾Ý¿â¶Ô»°£¬ËùÒÔ¶ÔÓÚ±¾µØÁÙʱ±í£¬Ê¹ÓÃexec(@sql)´´½¨ÁÙʱ±í£¬
ÔÚexecÍⲿ²»ÄÜÕýÈ··ÃÎÊ£»¶øʹÓÃÈ«¾ÖÁÙʱ±í¾ÍokÁË
*/ 
SQL code
exec ('select top 10 * into ##temp from syhouse');
exec ('select * from ##temp');


Ïà¹ØÎĵµ£º

datagirdviewºÍlistview,ɾ¸Ä²ésqlserverÊý¾Ý¿âµÄС½á

        //´´½¨DBhelperÊý¾Ý¿âÁ´½ÓÎļþ
        private static string sqlcon = "server=.;database=myschool;uid=sa;pwd=sa";
        public static SqlConnection connection = new SqlConnection(sqlcon ......

SqlServer ÊÓͼË÷Òý

ÔÚÊÓͼÉÏ´´½¨Ë÷ÒýµÄÁíÒ»¸öºÃ´¦ÊÇ£º²éѯÓÅ»¯Æ÷¿ªÊ¼ÔÚ²éѯÖÐʹÓÃÊÓͼË÷Òý
£¬
¶ø²»ÊÇÖ±½ÓÔÚ from
×Ó¾äÖÐÃüÁîÊÓͼ¡£ÕâÑùÒ»À´£¬¿É´ÓË÷ÒýÊÓͼ¼ìË÷Êý¾Ý¶øÎÞÐèÖØбàÂ룬ÓÉ´Ë´øÀ´µÄ¸ßЧÂÊҲʹÏÖÓвéѯ»ñÒæ¡£ÔÚÊÓͼÉÏ´´½¨µÄµÚÒ»¸öË÷Òý±ØÐëÊÇΨһ¾Û¼¯Ë÷Òý¡£ÔÚ´´
½¨Î¨Ò»¾Û¼¯Ë÷Òýºó£¬¿É´´½¨ÆäËü·Ç¾Û¼¯Ë÷Òý¡£ÊÓͼÉϵÄË÷ÒýÃüÃû¹æÔòÓë± ......

SQL LIKE ͨÅä·ûËæ±Ê £¨SqlServer£©

ͨÅä·û ˵Ã÷
_    ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
 
%    Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
 
[ ]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
 
[^]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
......

XpϵͳÏÂsqlServer 2000ÖÐ1433¶Ë¿Ú´ò²»¿ªµÄÎÊÌâ

 ÎÒ×°µÄÊÇXpϵͳ£¬µ±ÎÒ×°Sql Server2000Êý¾Ý¿âºó£¬ÓÃJava³ÌÐòÀ´½øÐÐÊý¾Ý¿âÁ¬½Óʱ³ö´íÁË£¬·¢ÏÖÊÇ1433¶Ë¿ÚûÓдò¿ª£¬ÔÚÍøÉÏÕÒÁËЩ½â¾ö°ì·¨£¬·½·¨ËµµÄ²»ÊǺÜÇå³þ£¬»¹ÓеãÂÞàÂÁË¡£ÎÒ½â¾öºó·¢ÏÖ°ì·¨ÊÇ£ºÊ×ÏÈÊDz鿴ÄãµÄ°æ±¾£¬¿ÉÒÔÓÃselect @@versionÀ´²é¿´¡£×°ÍêSql Server 2000 1433¶Ë¿ÚÓÐÊÇûÓдò¿ª£¬¿ÉÒÔÓÃnet -an -p tcp ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ