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

ÇóÒ»ÌõSQLÓï¾ä - MS-SQL Server / »ù´¡Àà

±íÃû: teacher ×ֶηֱðÓÐ ÐòºÅ£¬ÐÕÃû£¬ÄêÁ䣬ÐÔ±ð£¬ÄêÊÕÈë¡­¡­¡­¡­
ÏÖÏëÇóÒ»ÌõSQLÓï¾äÊÇ ³ýÁË"ÐòºÅ"Õâ¸ö×ֶβ»ÏÔʾ,ÆäËû×ֶξùÏÔʾµÄÓï¾ä£¬ ²¢·Ç select ÐÕÃû£¬ÄêÁ䣬ÐÔ±ð£¬ÄêÊÕÈë¡­¡­¡­¡­
from teacher ÕâÌõÓï¾ä(ÒòΪ×ֶμÙÉèÓÐ30¶à¸ö»áдËÀÈ˵Ä)лл£¡
Óö¯Ì¬SQL

SQL code:
DECLARE @s VARCHAR(8000)
SELECT @s = ISNULL(@s+',', '')+name
from syscolumns
WHERE id = OBJECT_ID('teacher')
AND name<>'ÐòºÅ'
EXEC ('SELECT '+@s+' from teacher')


²Î¿¼:
SQL code:
µÃµ½±íÖгýCol1¡¢Col2µÄËùÓÐÁÐ

ÀýÈ磺userno_fm¡¢userno_to
create table test(
num int identity(1,1),
userno_fm varchar(10),
userno_to varchar(10),
username varchar(10))
select * from test

declare @sql varchar(8000)
select @sql=''
select @sql=@sql+','+[name] from
(select [name] from syscolumns where object_id(N'[test]')=[id] and [name] not in ('userno_fm','userno_to')) A

set @sql='select '+stuff(@sql,1,1,'')+' from [test]'
--print @sql
exec (@sql)

drop table test



SQL code:
declare @sql varchar(8000)
select @sql=''
select @sql=@sql+','+[name] from
(selec


Ïà¹ØÎÊ´ð£º

sql ÎÊÌâ - MS-SQL Server / »ù´¡Àà

ÐèÇóÈçÏ£º
ѧԺ academy£¨aid,aname£©
°à¼¶ class£¨cid,cname,aid£©
ѧÉú stu(sid,sname,aid,cid)
סËÞÇø region(rid,rname)
ËÞÉáÂ¥ build(bid,rid,bnote) bnoteÊÇ¡®ÄС¯/¡®Å®¡¯
ËÞÉá dorm(did,rid,bid£¬bedn ......

Çóһʱ¼ä±È½ÏµÄSQL Ö¸Áî - MS-SQL Server / »ù´¡Àà

±íÊý¾Ý
COL1 COL2 COL2 COL4 COL5
----------------------------------------------------------------------------------------------
2010-05-05 00:00 ......

¹ØÓÚSQLÓï¾äORµÄÎÊÌâ - Oracle / ¸ß¼¶¼¼Êõ

ͨ¹ýNAME×Ö¶ÎÌõ¼þ²éѯһ¸öÊý¾Ý±í£¬¼ÙÉèÎÒÓÐ100¸öÐÕÃû£¬ÓÐÒÔÏÂÁ½¸ö·½·¨£¬
·½·¨1£º
°Ñ100¸öName ×é³ÉÒ»¸öSQLÓï¾ä£¬±ÈÈç Select * from tmp_table where Name='ÕÅÈý' or Name ='ÀîËÄ' Or ...Or Name='µÚÒ»°Ù¸öÐÕÃû'
......

ASPÒ³ÃæÎÞ·¨´ò¿ªÇóÖú£¡ - MS-SQL Server / »ù´¡Àà

¸÷λºÃ£¬ÎÒ¸Õ°ÑÒ»¸öASPÍøÕ¾ÉèÖúÃÁË£¬Ò²ÄÜÕý³£·ÃÎÊ¡£µ«ÊÇÔÚÎÒ±¾»úÉϲ»ÄÜ´ò¿ªadmin\login.asp,ËùÒÔÎÞ·¨ÊµÏÖºǫ́¹ÜÀí¡££¨´íÎóÌáʾÎÞ·¨ÕÒµ½ÍøÒ³£¬´úÂë404£¬ÎҵIJÙ×÷ϵͳÊÇwin2000 server)
µ«ÊÇÆæ¹ÖµÄÊÇÔÚ¾ÖÓòÍøµÄÆäËû» ......

C# SQL µÄUPDATETEXT ÎÊÌâ - .NET¼¼Êõ / C#

A±í ÓÐÁ½¸ö×ֶΠ
  id ΨһÊý×ÖÓò
  InfoTxt text ÀàÐÍ
 ÎÒÏÖÔÚÒª°Ñ id ²»ÊÇ14 µÄËùÓÐ InfoTxt×ֶΠÎı¾ºóÃæ ¶¼¼ÓÉÏ 'aaa' 
°´ÏÂÃæÖ´ÐÐÏÂÀ´ Ö»Óбí×îºóÒ»ÐмÓÉÏÁË 'aaa' ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ