½â¾öSQL ServerÀïsp_helptextÊä³ö¸ñʽ´íÐÐÎÊÌâ
use Master
go
if object_id('SP_SQL') is not null
drop proc SP_SQL
go
create proc [dbo].[SP_SQL](@ObjectName sysname)
as
set nocount on ;
declare @Print varchar(max)
if exists(select 1 from syscomments where ID=object_id(@ObjectName) and encrypted=1)
begin
Print N'對ÏóÒѼÓÃÜ!'
return
end
if coalesce(object_id(@ObjectName,N'P'),object_id(@ObjectName,N'FN'),object_id(@ObjectName,N'IF'),object_id(@ObjectName,N'TF'),object_id(@ObjectName,N'TR'),object_id(@ObjectName,N'V')) is null
begin
Print N'對ÏóÖ»針對º¯數¡¢´æ儲過³Ì¡¢觸發Æ÷¡¢視圖!'
return
end
print 'Use '+db_Name()
print 'Go'
print 'if object_ID('+quotename(case when charindex(']',@ObjectName)=0 then '['+replace(rtrim(@ObjectName),'.','].[')+']' else @ObjectName end ,'''')+') is not null'
print char(9)+'Drop '+case when object_id(@ObjectName,N'P') is not null then 'Procedure ' when Coalesce(object_id(@ObjectName,N'FN'),object_id(@ObjectName,N'IF'),object_id(@ObjectName,N'TF')) is not null then 'Function ' when object_id(@ObjectName,N'TR') is not null then 'Trigger ' else 'View 'end +case when charindex(']',@ObjectName)=0 then '['+replace(rtrim(@ObjectName),'.','].[')+']' else @ObjectName end
Print 'Go'
declare @T table(Col nvarchar(max))
insert @T select object_definition(object_id(@ObjectName)) +char(13)+char(10)
while (select max(Col) from @T)>''
begin
select top 1 @Print=left(Col,charindex(char(13)+char(10),Col)-1) from @T
print @Print
 
Ïà¹ØÎĵµ£º
ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·ûÃèÊö
%
Ìæ´úÒ»¸ö»ò¶à¸ö×Ö·û
_
½öÌæ´úÒ»¸ö×Ö·û
[charlist]
×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
[^charlist]
»òÕß
[!charlist]
²»ÔÚ×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
ÔʼµÄ±í (ÓÃÔÚÀý×ÓÖ ......
±¾ÎĵØÖ·£ºhttp://qzone.qq.com/blog/236000056-1217427602
ÎÞ·¨Á¬½Óµ½·þÎñÆ÷
·þÎñÆ÷£ºÏûÏ¢18452, ¼¶±ð16£¬×´Ì¬1
[Microsoft][ODBC SQLServer Driver][SQL Server]Óû§‘sa’µÇ½ʧ°Ü¡£ÔÒò£ºÎ´ÓëÐÅÈÎSQL ServerÁ¬½ÓÏà¹ØÁª
¸Ã´íÎó²úÉ ......
Ò»¡¢Ê¹ÓÃSqlConnection¶ÔÏóÁ¬½ÓSQL ServerÊý¾Ý¿â
1¡¢µÇ¼Êý¾Ý¿âµÄ·½Ê½ÎªSQL ServerÑé֤ģʽ
server=·þÎñÆ÷Ãû;database=Êý¾Ý¿âÃû³Æ;uid=Óû§;pwd=ÃÜÂë
2¡¢µÇ¼Êý¾Ý¿âµÄ·½Ê½ÎªWindowsÑé֤ģʽ
server=·þÎñÆ÷Ãû;database=Êý¾Ý¿âÃû³Æ;Integrated Security=SSPI
ÆäÖУ¬Integrated Security¼´Trusted_Connection,È¡Ö ......
Ò»°ãÓÃBCPÔÚ´¦ÀíÕâ¸öÊÂÇ飬µ«ÓÐʱҲÐèҪһЩÌØÊâµÄ´¦Àí£¬ÒÔÏÂÊÇÉú³É±íÖеÄһЩÊý¾Ý£¬´øÓÐwhereÌõ¼þµÄÑ¡ÔñÉú³ÉÊý¾Ý£¬ÊÇÎÒÒ»¸öͬÊÂÐ޸ĵģ¬Ö±½ÓÄùýÀ´ÓÃÁË£º
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create Proc proc_insert_where (@tablename varchar(256),@where varchar(256 ......