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

¶¯Ì¬SQLÓï¾ä

¶¯Ì¬Óï¾ä
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃexecÖ´ÐÐ
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fname from tableName -- ´íÎó,²»»áÌáʾ´íÎ󣬵«½á¹ûΪ¹Ì¶¨ÖµFiledName,²¢·ÇËùÒª¡£
exec('select ' + @fname + ' from tableName') -- Çë×¢Òâ ¼ÓºÅÇ°ºóµÄ µ¥ÒýºÅµÄ±ßÉϼӿոñ
µ±È»½«×Ö·û´®¸Ä³É±äÁ¿µÄÐÎʽҲ¿É
declare @fname varchar(20)
set @fname = 'FiledName' --ÉèÖÃ×Ö¶ÎÃû
declare @s varchar(1000)
set @s = 'select ' + @fname + ' from tableName'
exec(@s) -- ³É¹¦
exec sp_executesql @s -- ´Ë¾ä»á±¨´í
declare @s Nvarchar(1000) -- ×¢Òâ´Ë´¦¸ÄΪnvarchar(1000)
set @s = 'select ' + @fname + ' from tableName'
exec(@s) -- ³É¹¦
exec sp_executesql @s -- ´Ë¾äÕýÈ·
3. Êä³ö²ÎÊý
declare @num int, @sqls nvarchar(4000)
set @sqls='select count(*) from tableName'
exec(@sqls)
--ÈçºÎ½«execÖ´Ðнá¹û·ÅÈë±äÁ¿ÖУ¿
declare @num int, @sqls nvarchar(4000)
set @sqls='select @a=count(*) from tableName '
exec sp_executesql @sqls,N'@a int output',@num output
select @num
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃExecÖ´ÐР     Àý:      Select * from tableName
                Exec('select * from tableName')
                Exec sp_executesql N'select * from tableName'    -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
    ´íÎó:       declare @fname varchar(20)
                set @fname = 'FiledName'
                Select @fname from tableName   


Ïà¹ØÎĵµ£º

SQLÈÕÆÚ¸ñʽ»¯Ó¦ÓôóÈ«

Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GE ......

SQL Server 2005 Express Edition Óû§ÊµÀý

Roger Wolter
ÊÊÓÃÓÚ£º
SQL Server 2005 Express Edition
ÕªÒª£º±¾ÎĽéÉÜ SQL Server 2005 Express Edition ÖеÄÓû§ÊµÀý£¬ÒÔ¼°ÈçºÎʹÓÃËüÃÇÀ´¼ò»¯Ïò Visual Studio ÏîÄ¿Ìí¼ÓÊý¾Ý¿â¹¦ÄܵIJÙ×÷¡£
Äú¿ÉÒÔÏÂÔر¾ÎÄʹÓÃµÄ Microsoft Word °æ±¾¡£
±¾Ò³ÄÚÈÝ
¼ò½é
¸½¼ÓÊý¾Ý¿âÎļþ
AttachDBFilename
Óû§ÊµÀý
´ò¿ªÓ ......

SQL SERVER 2000 "MMCÎÞ·¨´´½¨¹ÜÀíµ¥Ôª

·½°¸Ò» ÔËÐÐmmc£¬È»ºó²Ù×÷£¬¿ØÖÆ̨–Ìí¼Ó/ɾ³ý¹ÜÀíµ¥Ôª–Ìí¼Ó–ÕÒµ½Microsoft SQL ÆóÒµ¹ÜÀíÆ÷–Ìí¼Ó–¹Ø±Õ–È·¶¨£¨×¢£º´Ë´¦µã»÷Ìí¼ÓÍêºó¾Í¿ÉÒԹرÕÁË£¬²»ÒªµÈ´ýÏìÓ¦£¬Èç¹ûÄã¶à´Îµã»÷ÁËÌí¼Ó£¬ºóÀ´¿ÉÒÔ¿´µ½n¶à¸ösqlÆóÒµ¹ÜÀíÆ÷¡£¡£¡££©£¬Ôٻص½¿ØÖÆ̨–Ñ¡Ïî–¿ØÖÆ̨ģʽѡÔñ”Óà ......

SQL Server2005 ±í·ÖÇø

---1¡¢Ìí¼ÓÊý¾ÝÎļþ
use master
go
--Fam200901
alter database RedfDB
add filegroup FGAM200901
go
alter database RedfDB
add file(name='FGAM200901',filename='D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Fam200901.mdf',
      size=20,maxsize=40,filegrowth=10% ......

¹æ»®ÔºÅàѵ·ÑÓÃͳ¼Æ²éѯµÄsqlÓï¾ä

create or replace view pxfy_view as
select t1.form_id,t1.reserve as mid,t1.feiyong,t.cjpxr_name as full_name,1 as pxlx,t1.topic,t1.identity,
     t1.begin_time as CREATEDATE,t1.end_time as completedate,pv.city,pv.DEPT_ID
     from wf_oa_pxnb_cjry t,WF_OA_PX ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ