本站首页    管理页面    写新日志    退出


«November 2019»
12
3456789
10111213141516
17181920212223
24252627282930


公告
暂无公告...

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:VFP及Sql Server拙笔
日志总数:46
评论数量:107
留言数量:0
访问次数:385064
建立时间:2005年5月12日




[VFP与SQL]VFP获取 SQL Server 常用脚本
文章收藏,  网上资源,  事件记录,  软件技术,  电脑与网络

老瓷 发表于 2008-1-19 2:06:11

*-----------------------------------------------* SqlServer 相关函数*-----------------------------------------------Clear*-----------------------------------------------* 测试 GetTableCode()*-----------------------------------------------Local lcDataBaseName, lcTableName, lcTableCode, lnSqlHandle, lcSqlStringConnectlcTableCode = []lcDataBaseName = [DCLZ]lcTableName = "[dbo].[考勤原始表]"lcSqlStringConnect = [driver={Sql server};server=(local);uid=sa;pwd=Admin;database=Master]lnSqlHandle = Sqlstringconnect( lcSqlStringConnect )If lnSqlHandle > 0    = SQLSetprop(lnSqlHandle,[DispWarnings], (.T.))    lcTableCode = GetTableCode( lnSqlHandle, lcDataBaseName, lcTableName )    = SQLDisconnect(lnSqlHandle)    If !Empty(lcTableCode)        _Cliptext = lcTableCode        Modify File ([(]+lcDataBaseName+[)]+lcTableName+[.sql]) Nowait        Keyboard [{CTRL+A}]        Keyboard [{CTRL+V}]    EndifEndifReturn *-----------------------------------------------* 测试 GetProcedreCode()*-----------------------------------------------Local lcDataBaseName, lcProcedreName, lcProcedreCode, lnSqlHandle, lcSqlStringConnectlcProcedreCode = []lcDataBaseName = [DCLZ]lcProcedreName = [dbo.ins考勤原始表]lcSqlStringConnect = [driver={Sql server};server=(local);uid=sa;pwd=Admin;database=Master]lnSqlHandle = Sqlstringconnect( lcSqlStringConnect )If lnSqlHandle > 0    = SQLSetprop(lnSqlHandle,[DispWarnings], (.T.))    lcProcedreCode = GetProcedreCode( lnSqlHandle, lcDataBaseName, lcProcedreName )    = SQLDisconnect(lnSqlHandle)    If !Empty(lcProcedreCode)        _Cliptext = lcProcedreCode        Modify File ([(]+lcDataBaseName+[)]+lcProcedreName+[.sql]) Nowait        Keyboard [{CTRL+A}]        Keyboard [{CTRL+V}]    EndifEndifReturn*----------------------------------------------- *-----------------------------------------------* 函数: 获取SQL Server加密存储过程、函数、*       视图、触发器  脚本,字节不受限制* 设计: 红雨* 时间: 2004.04.01*-----------------------------------------------Function GetProcedreCode( tnSqlHandle, tcDataBase, tcObjectName )    *-----------------------------------------------    #Define CR Chr(13)+Chr(10)    Local lcReturn, lcTmpCursor, lcMyProcedure    m.lcReturn = []    m.lcTmpCursor = [T]+Sys(2015)    m.lcDataBase = Iif(Type([m.tcDataBase])=[C] And !Empty(m.tcDataBase), m.tcDataBase, [Master])    If Used(m.lcTmpCursor)        Use In (m.lcTmpCursor)    Endif    *-----------------------------------------------    If Type([m.tnSqlHandle])=[N] And m.tnSqlHandle>0 And Type([m.tcObjectName])=[C]        = Sqlexec(m.tnSqlHandle, "use " + m.lcDataBase )        m.lcMyProcedure = "CREATE PROCEDURE " + m.lcTmpCursor + "( @objectName varchar(50) )" ;            +CR+ " AS" ;            +CR+ " begin" ;            +CR+ " set nocount on" ;            +CR+ " begin tran" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ " Declare @objectname1 varchar(100)," ;            +CR+ "         @orgvarbin varbinary(8000)" ;            +CR+ " Declare @sql1 nvarchar(4000)," ;            +CR+ "         @sql2 varchar(8000)," ;            +CR+ "         @sql3 nvarchar(4000)," ;            +CR+ "         @sql4 nvarchar(4000)" ;            +CR+ " Declare @OrigSpText1 nvarchar(4000)," ;            +CR+ "         @OrigSpText2 nvarchar(4000)," ;            +CR+ "         @OrigSpText3 nvarchar(4000)," ;            +CR+ "         @resultsp nvarchar(4000)," ;            +CR+ "         @ptrval binary(16)," ;            +CR+ "         @prvlen Int" ;            +CR+ " Declare @i Int," ;            +CR+ "         @Status Int," ;            +CR+ "         @Type varchar(10)," ;            +CR+ "         @parentid Int" ;            +CR+ " Declare @colid Int," ;            +CR+ "         @N Int," ;            +CR+ "         @q Int," ;            +CR+ "         @j Int," ;            +CR+ "         @k Int," ;            +CR+ "         @Encrypted Int," ;            +CR+ "         @Number Int"        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ " Select @Type=xtype, @parentid=parent_obj From sysobjects Where Id=object_id(@ObjectName)" ;            +CR+ " " ;            +CR+ " If exists (select * from dbo.sysobjects where id = object_id(N'#result') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" ;            +CR+ "   Drop Table #result" ;            +CR+ " Create Table #result(ProcName varchar(50), ProcCode text)" ;            +CR+ " Insert #result values (@ObjectName, '')" ;            +CR+ " " ;            +CR+ " If exists (select * from dbo.sysobjects where id = object_id(N'#temp') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" ;            +CR+ "   Drop Table #temp" ;            +CR+ " Create Table #temp(Number Int,colid Int,ctext varbinary(8000),Encrypted Int,Status Int)" ;            +CR+ " Insert #temp Select Number,colid,ctext,Encrypted,Status From syscomments Where Id = object_id(@objectName)" ;            +CR+ " " ;            +CR+ " Select @Number=Max(Number) From #temp" ;            +CR+ " Set @k=0" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ " While @k<=@Number" ;            +CR+ "   Begin" ;            +CR+ "   If Exists(Select 1 From syscomments Where Id=object_id(@objectname) And Number=@k)" ;            +CR+ "     Begin" ;            +CR+ "     If @Type='P'" ;            +CR+ "       Set @sql1=(" ;            +CR+ "         CASE" ;            +CR+ "           When @Number>1 Then 'ALTER PROCEDURE '+ @objectName +';'+Rtrim(@k)+' WITH ENCRYPTION AS '" ;            +CR+ "           Else 'ALTER PROCEDURE '+ @objectName+' WITH ENCRYPTION AS '" ;            +CR+ "         END      )" ;            +CR+ "     If @Type='TR'" ;            +CR+ "       Begin" ;            +CR+ "       Declare @parent_obj varchar(255)," ;            +CR+ "               @tr_parent_xtype varchar(10)" ;            +CR+ "       Select @parent_obj = parent_obj From sysobjects Where Id=object_id(@objectName)" ;            +CR+ "       Select @tr_parent_xtype = xtype From sysobjects Where Id=@parent_obj" ;            +CR+ "       If @tr_parent_xtype='V'" ;            +CR+ "         Begin" ;            +CR+ "         Set @sql1='ALTER TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTERD OF INSERT AS PRINT 1 '" ;            +CR+ "         End" ;            +CR+ "       Else" ;            +CR+ "         Begin" ;            +CR+ "         Set @sql1='ALTER TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 '" ;            +CR+ "         End" ;            +CR+ "       End" ;            +CR+ "     If @Type='FN' Or @Type='TF' Or @Type='IF'" ;            +CR+ "       Set @sql1=(" ;            +CR+ "         Case @Type" ;            +CR+ "           When 'TF' Then 'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end '" ;            +CR+ "           When 'FN' Then 'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end'" ;            +CR+ "           When 'IF' Then 'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns table with encryption as return select @a as a'" ;            +CR+ "         END      )" ;            +CR+ "     If @Type='V'" ;            +CR+ "       Set @sql1='ALTER VIEW '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f'" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "     Set @q=Len(@sql1)" ;            +CR+ "     Set @sql1=@sql1+Replicate('-',4000-@q)" ;            +CR+ "     Select @sql2=Replicate('-',8000)" ;            +CR+ "     Set @sql3='exec(@sql1'" ;            +CR+ "     Select @colid=Max(colid) From #temp Where Number=@k" ;            +CR+ "     Set @N=1" ;            +CR+ "     While @N<=Ceiling(1.0*(@colid-1)/2) And Len(@sQL3)<=3996" ;            +CR+ "       Begin" ;            +CR+ "       Set @sql3=@sql3+'+@'" ;            +CR+ "       Set @N=@N+1" ;            +CR+ "       End" ;            +CR+ "     Set @sql3=@sql3+')'" ;            +CR+ "     Exec sp_executesql @sql3,N'@Sql1 nvarchar(4000),@ varchar(8000)',@sql1=@sql1,@=@sql2" ;            +CR+ "     End" ;            +CR+ "   Set @k=@k+1" ;            +CR+ "   End" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ " Set @k=0" ;            +CR+ " While @k<=@Number" ;            +CR+ "   Begin" ;            +CR+ "   If Exists(Select 1 From syscomments Where Id=object_id(@objectname) And Number=@k)" ;            +CR+ "     Begin" ;            +CR+ "     Select @colid=Max(colid) From #temp Where Number=@k" ;            +CR+ "     Set @N=1" ;            +CR+ "     While @N<=@colid" ;            +CR+ "       Begin" ;            +CR+ "       Select @OrigSpText1=ctext,@Encrypted=Encrypted,@Status=Status From #temp Where colid=@N And Number=@k" ;            +CR+ "       Set @OrigSpText3=(Select ctext From syscomments Where Id=object_id(@objectName) And colid=@N And Number=@k)" ;            +CR+ "       If @N=1" ;            +CR+ "         Begin" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "         If @Type='P'" ;            +CR+ "           Set @OrigSpText2=(" ;            +CR+ "             CASE" ;            +CR+ "               When @Number>1 Then 'CREATE PROCEDURE '+ @objectName +';'+Rtrim(@k)+' WITH ENCRYPTION AS '" ;            +CR+ "               Else 'CREATE PROCEDURE '+ @objectName +' WITH ENCRYPTION AS '" ;            +CR+ "             END            )" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "         If @Type='FN' Or @Type='TF' Or @Type='IF'" ;            +CR+ "           Set @OrigSpText2=(" ;            +CR+ "             Case @Type" ;            +CR+ "               When 'TF' Then 'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end '" ;            +CR+ "               When 'FN' Then 'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end'" ;            +CR+ "               When 'IF' Then 'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns table with encryption as return select @a as a'" ;            +CR+ "             END            )" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "         If @Type='TR'" ;            +CR+ "           Begin" ;            +CR+ "           If @tr_parent_xtype='V'" ;            +CR+ "             Begin" ;            +CR+ "             Set @OrigSpText2='CREATE TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTEAD OF INSERT AS PRINT 1 '" ;            +CR+ "             End" ;            +CR+ "           Else" ;            +CR+ "             Begin" ;            +CR+ "             Set @OrigSpText2='CREATE TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 '" ;            +CR+ "             End" ;            +CR+ "           End" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "         If @Type='V'" ;            +CR+ "           Set @OrigSpText2='CREATE VIEW '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f'" ;            +CR+ " " ;            +CR+ "         Set @q=4000-Len(@OrigSpText2)" ;            +CR+ "         Set @OrigSpText2=@OrigSpText2+Replicate('-',@q)" ;            +CR+ "         End" ;            +CR+ "       Else" ;            +CR+ "         Begin" ;            +CR+ "         Set @OrigSpText2=Replicate('-', 4000)" ;            +CR+ "         End" ;            +CR+ " "        lcMyProcedure = lcMyProcedure ;            +CR+ "       Set @i=1" ;            +CR+ "       Set @resultsp = Replicate(N'A', (datalength(@OrigSpText1) / 2))" ;            +CR+ " " ;            +CR+ "       While @i<=datalength(@OrigSpText1)/2" ;            +CR+ "         Begin" ;            +CR+ "         Set @resultsp = Stuff(@resultsp, @i, 1," ;            +CR+ "           NCHAR(UNICODE(Substring(@OrigSpText1, @i, 1)) ^" ;            +CR+ "                (UNICODE(Substring(@OrigSpText2, @i, 1)) ^" ;            +CR+ "                 UNICODE(Substring(@OrigSpText3, @i, 1)))))" ;            +CR+ "         Set @i=@i+1" ;            +CR+ "         End" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "       Set @orgvarbin=cast(@OrigSpText1 As varbinary(8000))" ;            +CR+ "       Set @resultsp=(" ;            +CR+ "         Case " ;            +CR+ "           When @Encrypted=1 Then @resultsp" ;            +CR+ "           Else convert(nvarchar(4000)," ;            +CR+ "             Case " ;            +CR+ "               When @Status&2=2 Then uncompress(@orgvarbin)" ;            +CR+ "               Else @orgvarbin" ;            +CR+ "             END        )" ;            +CR+ "         END          )" ;            +CR+ "       Print @resultsp" ;            +CR+ "       select @ptrval = TEXTPTR(ProcCode) from #result" ;            +CR+ "       select @prvlen = DATALENGTH(ProcCode) from #result" ;            +CR+ "       UPDATETEXT #result.ProcCode @ptrval @prvlen 0 @resultsp" ;            +CR+ " "        m.lcMyProcedure = m.lcMyProcedure ;            +CR+ "       Set @N=@N+1" ;            +CR+ "       End" ;            +CR+ "     End" ;            +CR+ "   Set @k=@k+1" ;            +CR+ "   End" ;            +CR+ " Select * from #result" ;            +CR+ " Drop Table #temp" ;            +CR+ " Drop Table #result" ;            +CR+ " Rollback Tran" ;            +CR+ " End"        *-----------------------------------------------        = Sqlexec(m.tnSqlHandle, "if exists (select * from dbo.sysobjects" ;            +CR+ " where id = object_id(N'[dbo].[" + m.lcTmpCursor + "]')" ;            +CR+ " and OBJECTPROPERTY(id, N'IsProcedure') = 1)" ;            +CR+ " drop procedure [dbo].[" + m.lcTmpCursor + "]")        = Sqlexec(m.tnSqlHandle, m.lcMyProcedure )        = Sqlexec(m.tnSqlHandle, "Exec " + m.lcTmpCursor + " ?tcObjectName", m.lcTmpCursor)        = Sqlexec(m.tnSqlHandle, "if exists (select * from dbo.sysobjects" ;            +CR+ " where id = object_id(N'[dbo].[" + m.lcTmpCursor + "]')" ;            +CR+ " and OBJECTPROPERTY(id, N'IsProcedure') = 1)" ;            +CR+ " drop procedure [dbo].[" + m.lcTmpCursor + "]")        *-----------------------------------------------        If Used(m.lcTmpCursor)            Select (m.lcTmpCursor)            m.lcReturn = Alltrim(ProcCode)            Use In (m.lcTmpCursor)        Endif    Endif    Return m.lcReturnEndfunc *-----------------------------------------------* 函数: 获取SQL Server表脚本(创建、触发器、索引、约束)* 设计: 红雨* 时间: 2005.04.01*-----------------------------------------------Function GetTableCode( tnSqlHandle, tcDataBase, tcObjectName )    *-----------------------------------------------    #Define CR Chr(13)+Chr(10)    Local lcReturn, lcTmpCursor, lcMyProcedure    m.lcReturn = []    m.lcTmpCursor = [T]+Sys(2015)    m.lcDataBase = Iif(Type([m.tcDataBase])=[C] And !Empty(m.tcDataBase), m.tcDataBase, [Master])    If Used(m.lcTmpCursor)        Use In (m.lcTmpCursor)    Endif    *-----------------------------------------------    If Type([m.tnSqlHandle])=[N] And m.tnSqlHandle>0 And Type([tcObjectName])=[C]        = Sqlexec(m.tnSqlHandle, [use ] + m.lcDataBase )        *-----------------------------------------------        * 建立表的脚本        *-----------------------------------------------        = SQLExec(m.tnSqlhandle,[EXEC sp_MShelpcolumns N'] + m.tcObjectName + [', 512, @orderby = 'id'] , m.lcTmpCursor)        If Used(m.lcTmpCursor)            Select (m.lcTmpCursor)            m.lcReturn = m.lcReturn + CR + [--- 建立表的脚本] + CR            m.lcReturn = m.lcReturn + [If Exists (Select * From dbo.SysObjects Where id = object_id(N']+m.tcObjectName+[')] ;                + [ and OBJECTPROPERTY(id, N'IsTable') = 1)]            m.lcReturn = m.lcReturn + CR + [  Drop table ] + m.tcObjectName            m.lcReturn = m.lcReturn + CR + [GO]            m.lcReturn = m.lcReturn + CR + [Create Table ] + m.tcObjectName + [(]            Local lTextImage            m.lTextImage = .F.            Scan                m.lTextImage = m.lTextImage Or Inlist(Upper(Alltrim(Col_TypeName)),[TEXT],[NTEXT],[IMAGE])                m.lcReturn = m.lcReturn + CR + "  [" + Alltrim(Col_Name) + "] ";                    + "[" + Alltrim(Col_TypeName) + "]" ;                    + Iif(Col_Flags=0, [], " (" + Iif(Isnull(Col_Prec),Alltrim(Str(Col_Len)),Alltrim(Str(Col_Prec))) ;                    +     Iif(Isnull(Col_Scale), [], [, ] + Alltrim(Str(Col_Scale))) + ")" ) ;                    + Iif(Isnull(Collation),[],[ Collate ] + Alltrim(Collation)) ;                    + Iif(Col_Identity,[ Identity (1, 1)],[]) ;                    + Iif(Col_Null, [ Null] ,[ Not Null]) + [,]            Endscan            m.lcReturn = Left(m.lcReturn,Len(m.lcReturn)-1) + CR + ") ON [PRIMARY]"            m.lcReturn = m.lcReturn + Iif(m.lTextImage," TEXTIMAGE_ON [PRIMARY]",[]) + CR + [GO] + CR            Use In (m.lcTmpCursor)        Endif        *-----------------------------------------------        * 表的索引脚本        *-----------------------------------------------        = SQLExec(m.tnSqlhandle,[EXEC sp_MShelpindex N'] + m.tcObjectName +[' , NULL, 1] , m.lcTmpCursor)        If Used(m.lcTmpCursor) And Reccount(m.lcTmpCursor) > 0            Local cFieldName, nIndex            Select (m.lcTmpCursor)            m.lcReturn = m.lcReturn + CR + [--- 表的索引脚本] ;                +CR+ [Create] + Iif(.F.,[ Unique],[]) + Iif(indid=1,[ Clustered],[]) ;                +CR+ "  Index [" +Alltrim(Name)+ "] On " + m.tcObjectName +[ (]            For m.nIndex = 1 To 16                m.cFieldName = [IndCol]+Alltrim(Str(nIndex))                If Isnull(Evaluate(m.cFieldName))                    Exit                Endif                m.lcReturn = m.lcReturn + "[" + Alltrim(Evaluate(m.cFieldName)) + "]" ;                    + Iif(Bitand(2^(nIndex-1),Descending) = 2^(nIndex-1), [ Desc,], [ ,])            Endfor            m.lcReturn = Left(m.lcReturn,Len(m.lcReturn)-1) + ") "            m.lcReturn = m.lcReturn ;                +CR+ [With] ;                +CR+ [  DROP_EXISTING] ;                +CR+ "  ON [PRIMARY]" + CR + [GO] + CR            Use In (m.lcTmpCursor)        Endif        *-----------------------------------------------        * 约束和触发器        *-----------------------------------------------        = Sqlexec(m.tnSqlHandle, [select Name,xType from SysObjects ] ;            + [ where parent_obj=object_id(N']+m.tcObjectName+[') order by xType], m.lcTmpCursor)        If Used(m.lcTmpCursor)            Select (m.lcTmpCursor)            Scan                m.lcReturn = m.lcReturn + CR                lcName = Alltrim(Name)                Do Case                    Case Upper(Alltrim(xType))=[TR]                        m.lcReturn = m.lcReturn + [--- 触发器脚本: ] + lcName + CR ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[TF]                        m.lcReturn = m.lcReturn + [--- 表函数: ] + lcName + CR ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[IF]                        m.lcReturn = m.lcReturn + [--- 内嵌表函数: ] + lcName + CR ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[D]                        m.lcReturn = m.lcReturn + [--- 默认值或 DEFAULT 约束: ] + lcName + CR ;                            + [ALTER TABLE ] + m.tcObjectName + [ WITH NOCHECK ADD] + CR ;                            + "  CONSTRAINT [" + lcName + "] DEFAULT " ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName ) ;                            + " FOR [" + Getwordnum(lcName,3,[_]) + "]"                    Case Upper(Alltrim(xType))=[C]                        m.lcReturn = m.lcReturn + [--- CHECK 约束: ] + lcName + CR ;                            + [ALTER TABLE ] + m.tcObjectName + [ WITH NOCHECK ADD] + CR ;                            + "  CONSTRAINT [" + lcName + "] CHECK " ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[F]                        m.lcReturn = m.lcReturn + [--- FOREIGN KEY 约束: ] + lcName + CR ;                            + [ALTER TABLE ] + m.tcObjectName + [ WITH NOCHECK ADD] + CR ;                            + "  CONSTRAINT [" + lcName + "] FOREIGN KEY " ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[PK]                        m.lcReturn = m.lcReturn + [--- PRIMARY KEY 约束: ] + lcName + CR ;                            + [ALTER TABLE ] + m.tcObjectName + [ ADD] + CR ;                            + "  CONSTRAINT [" + lcName + "] PRIMARY KEY " ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Case Upper(Alltrim(xType))=[UQ]                        m.lcReturn = m.lcReturn + [--- UNIQUE 约束: ] + lcName + CR ;                            + [ALTER TABLE ] + m.tcObjectName + [ ADD] + CR ;                            + "  CONSTRAINT [" + lcName + "] UNIQUE " ;                            + GetProcedreCode( m.tnSqlHandle, m.lcDataBase, lcName )                    Otherwise                Endcase                m.lcReturn = m.lcReturn + CR + [GO] + CR            Endscan            Use In (m.lcTmpCursor)        Endif        *-----------------------------------------------    Endif    Return m.lcReturnEndfunc *-----------------------------------------------


阅读全文(7828) | 回复(3) | 编辑 | 精华
 


回复:VFP获取 SQL Server 常用脚本
文章收藏,  网上资源,  事件记录,  软件技术,  电脑与网络

king(游客)发表评论于2009-3-17 15:06:32

我知道无论用多么华丽的辞藻来形容版主您帖子的精彩程度都是不够的,都是虚伪的,所以我只想说一句:您的帖子太好看了!我愿意一辈子的看下去!T1 cell phone, Cell Phone Watch, TV Cell Phones, Watch Cell Phones, Multi Function Cell Phones, Iphone and Series, Wifi Cell Phones, Bluetooth Cell Phones , Refurbished Cell Phones, Pda cell phone, Pda business cell phone, pda internet cell phone, business cellphone, pda touch screen cell phone, qwerty keyboard cell phones, dual sim Pda cell phone


个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


回复:VFP获取 SQL Server 常用脚本
文章收藏,  网上资源,  事件记录,  软件技术,  电脑与网络

老瓷发表评论于2008-6-17 13:06:10

以下引用风风(游客)在2008-6-11 17:23:08的评论:如何在VFP中创建SQL数据库,不用升迁有没有办法不用升迁?新建数据库,还要不要原来的VFP表的结构建SQL表?

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


回复:VFP获取 SQL Server 常用脚本
文章收藏,  网上资源,  事件记录,  软件技术,  电脑与网络

风风(游客)发表评论于2008-6-11 17:23:08

如何在VFP中创建SQL数据库,不用升迁有没有办法

个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除
 


» 1 »

发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.047 second(s), page refreshed 144326789 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号