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

Æ´½ÓSQLÓï¾äµÄÎÊÌâ

SQL code:

declare @topCount int
select @topCount=10

declare @sql nvarchar(400)

set @sql=N'select top @topCount * from tb_company'
exec sp_executesql @sql





Incorrect syntax near '@topCount'.

Õâ¸öÎÊÌâÒªÔõô½â¾ö
Êä³ö²ÎÊýÐÎʽ
ÓÃSP_EXECUTESQLÖ´ÐÐ


SQL code:
declare @topCount int
select @topCount=10

declare @sql nvarchar(400)

set @sql=N'select top '+@topCount+' * from tb_company'
exec sp_executesql @sql


ÒýÓÃ
Êä³ö²ÎÊýÐÎʽ
ÓÃSP_EXECUTESQLÖ´ÐÐ

Ū´í

SQL code:
declare @topCount int
select @topCount=10

declare @sql nvarchar(400)

set @sql='select top '+@topCount+' * from tb_company'
exec (@sql)



SQL code:
set @sql=N'select top '+@topCount+' * from tb_company'


ÒýÓÃ
SQL codedeclare@topCountintselect@topCount=10declare@sqlnvarchar(400)set@sql=N'select top +ltrim(@topCount)+'*from tb_compa


Ïà¹ØÎÊ´ð£º

SQLÓï¾äЧÂÊÎÊÌâ - ÆäËûÊý¾Ý¿â¿ª·¢ / ÆäËûÊý¾Ý¿â

´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
  ±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......

ÇóÒ»SQL - MS-SQL Server / »ù´¡Àà

±íÈçÏÂ
½ÌÊÒID ×ùλÊý ¿ªÊ¼Ê±¼ä ½áÊøÊ±¼ä 2009Äê1ÔÂ1ÈÕ 2009Äê1ÔÂ2ÈÕ 2009Äê1ÔÂ3ÈÕ
  101 50 08£º00 08£º30 30 40 50  
  101 50 09£º00 ......

sqlת»»ÎÊÌ⣬¼±£¡ - ÉçÇøÖ§³Ö / ¡¶³ÌÐòÔ±¡·ÔÓÖ¾

select convert(varchar(50),cast(convert(numeric(18,2),1275674000000/100000000)as real))+'ÒÚ'
select cast(convert(numeric(18,2),1275674000000/100000000)as real)
ΪʲôÉÏÒ»¸öÓÃvarcharת»»ºó¾ÍÖ»±£ÁôÁËÒ ......

ÇóÒ»Ìõoracle¶à±í²éѯµÄsql£¬Çó¸ßÊÖÃDz»ÁߴͽÌ~

table1:
uID    uName
1      СÀî 
2      СÕÅ

table2:
pID  uID  type
1    1    H1
2    ......

sql´ïÈËÈ룬ÇóÒ»¾äsql£¬»òÕ߸ø³öÏàÓ¦µÄ½â¾ö·½°¸



±ía

Ïß·´úÂë Ïß·Ãû³Æ  Main_ID 
cir11    cirA        1
cir21    cirB        1
cir13    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ