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

sqlÈ¡²éѯֵ

ÈçÌ⣺select name from table1
µÃµ½½á¹û£ºname
          СÍõ
          СÕÔ
          СÀî
          СÖÜ
ÏëÒª½á¹û£º
°Ñ²éѯµ½µÄ½á¹û¸³Öµ¸ø@SQL
Ô­Ö°£º@sql='admin'
ÏëÒª½á¹û£º@sql=@sql+',СÍõ£¬Ð¡ÕÔ£¬Ð¡ÀСÖÜ'
×¢£º¾¡Á¿²»Òªdo..whileÑ­»·
ÔÚÏߵȣ¬Óв»¶®µØ·½Çë˵£¡


¶¥¶¥

declare @sql varchar(500)
select @sql='admin'
select @sql=@sql+','+name from table1
print @sql
ÎÊÌâ»ù±¾½â¾ö£¬¿ÉÊÇ [tabel]±íÊDZäÁ¿£¬²»È·¶¨
¸ÃÈçºÎ

ÒýÓÃ
declare @sql varchar(500)
select @sql='admin'
select @sql=@sql+','+name from table1
print @sql
ÎÊÌâ»ù±¾½â¾ö£¬¿ÉÊÇ [tabel]±íÊDZäÁ¿£¬²»È·¶¨
¸ÃÈçºÎ


SQL code:
declare @table1 nvarchar(50)
set @table1 = '****'
...
exec 'select @sql = @sql + '',''+ name from @table1'
...


ѧϰ

ÒýÓÃ
declare @sql varchar(500)
select @sql='admin'
select @sql=@sql+','+name from table1
print @sql
ÎÊÌâ»ù±¾½â¾ö£¬¿ÉÊÇ [tabel]±íÊDZäÁ¿£¬²»È·¶¨
¸ÃÈçºÎ

ÄǾÍÏñÎÒÃÇÒ»°ãº¯ÊýÑùµÄ


Ïà¹ØÎÊ´ð£º

sql server ´æ´¢¹ý³ÌÑ­»·¸³ÖµµÄÎÊÌâ

СµÜÊǸöÐÂÊÖ ÏÖÔÚÓиöÎÊÌâÒ»Ö±²»Äܽâ¾ö
ÀýÈç
procedure produce_proc
    @p001 nvarchar(8000),
    @p002 nvarchar(8000),
    @p003 nvarchar(8000),
  & ......

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......

delphiÖÐexcelµ¼Èësql serverµÄÎÊÌâ¡£

'Select * into mytable from OpenDataSource(''Microsoft.JET.OLEDB.4.0'',''Data Source=f:\test.xls;Mode=Read;Extended Properties=Excel 5.0;Persist Security Info=False' ......

SQL Óï¾ä¡£¡£ Çë½Ì¸ßÊÖ

ÏÈÀ´Ò»¸ö´íÎóÓï¾ä¡£¡£
select * from [aa] where a1 in (select max(a2),a1 from [aa]  group by a1 )


ÎÒ´óÌåÒâ˼£¬
¶Áȡһ¸öͳ¼ÆÏµÍ³ÖÐ ²»Öظ´µÄ IP °´ÕÕ ×îºóʱ¼äÅÅÐò£¬²¢ÏÔʾ³öËùÓÐ×ֶΡ£¡ ......

SQLÓï¾ä

BeginTime  BtsId Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
2009-10-5 0:00 1 256
2009-10-6 0:0 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ