国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開(kāi)通VIP
得到對(duì)象腳本

得到對(duì)象腳本

[日期:2005-07-08]來(lái)源:CSDN  作者:[字體: ]

/*
 在查詢分析器中調(diào)用sqldmo生成腳本--存儲(chǔ)過(guò)程

鄒建 2003.07-----------------*/

/*--調(diào)用實(shí)例
 declare @str varchar(8000)
 exec sp_getscript ‘zj‘,‘‘,‘‘,‘xzkh_sa‘,‘地區(qū)資料‘,@str output
 print @str
*/
if exists(select 1 from sysobjects where id=object_id(‘sp_getscript‘) and objectproperty(id,‘IsProcedure‘)=1)
 drop procedure sp_getscript
go
create procedure sp_getscript
 @servername varchar(50)      --服務(wù)器名
 ,@userid varchar(50)       --用戶名,如果為nt驗(yàn)證方式,則為空
 ,@password varchar(50)      --密碼
 ,@databasename varchar(50)    --數(shù)據(jù)庫(kù)名稱
 ,@objectname varchar(250)     --對(duì)象名
 ,@re varchar(8000) output     --返回腳本
as
declare @srvid int,@dbsid int    --定義服務(wù)器、數(shù)據(jù)庫(kù)集id
declare @dbid int,@tbid int     --數(shù)據(jù)庫(kù)、表id
declare @err int,@src varchar(255), @desc varchar(255) --錯(cuò)誤處理變量

--創(chuàng)建sqldmo對(duì)象
exec @err=sp_oacreate ‘sqldmo.sqlserver‘,@srvid output
if @err<>0 goto lberr

--連接服務(wù)器
if isnull(@userid,‘‘)=‘‘ --如果是 Nt驗(yàn)證方式
begin
 exec @err=sp_oasetproperty @srvid,‘loginsecure‘,-1
 if @err<>0 goto lberr

 exec @err=sp_oamethod @srvid,‘connect‘,null,@servername
end
else
 exec @err=sp_oamethod @srvid,‘connect‘,null,@servername,@userid,@password

if @err<>0 goto lberr

--獲取數(shù)據(jù)庫(kù)集
exec @err=sp_oagetproperty @srvid,‘databases‘,@dbsid output
if @err<>0 goto lberr

--獲取要取得腳本的數(shù)據(jù)庫(kù)id
exec @err=sp_oamethod @dbsid,‘item‘,@dbid output,@databasename
if @err<>0 goto lberr

--獲取要取得腳本的對(duì)象id
exec @err=sp_oamethod @dbid,‘getobjectbyname‘,@tbid output,@objectname
if @err<>0 goto lberr

--取得腳本
exec @err=sp_oamethod @tbid,‘script‘,@re output
if @err<>0 goto lberr

--print @re
return

lberr:
 exec sp_oageterrorinfo NULL, @src out, @desc out
 declare @errb varbinary(4)
 set @errb=cast(@err as varbinary(4))
 exec master..xp_varbintohexstr @errb,@re out
 select 錯(cuò)誤號(hào)=@re, 錯(cuò)誤源=@src, 錯(cuò)誤描述=@desc
 return

go

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
CSDN技術(shù)中心 復(fù)制表結(jié)構(gòu)的通用存儲(chǔ)過(guò)程
導(dǎo)入/導(dǎo)出Excel-完全正確-推薦
用Sql語(yǔ)句將SqlServer數(shù)據(jù)表中的數(shù)據(jù)導(dǎo)入到Access
實(shí)用t
導(dǎo)出SQL Server表到DBF文件的存儲(chǔ)過(guò)程
sql server 1
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服