如果表存在,如何调用过程? [英] how to call a procedure if table exists?

查看:61
本文介绍了如果表存在,如何调用过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果表存在则如何在不同连接中调用过程并且如果表存在则更新shud

how to call procedure in diffrent connection if table exists and update shud be perforemed if table exists

推荐答案

您可以尝试下面的代码: -



you can try below code:-

IF exists (select * from  OPENDATASOURCE( 'SQLNCLI', 'Data Source= User ID=; Password=').DBName.dbo.TableName
 where id = object_id(N'[dbo].[TableName ]') and OBJECTPROPERTY(id, N'IsTable') = 1)
        Execute('select date from a.table1
                call table
                call proc with date parameter+1;')
ELSE
BEGIN
   call table;
   call proc with date parameter;
END


这篇关于如果表存在,如何调用过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆