如何使用变量传递数据库的名称? [英] How to pass the name for database using variable?

查看:56
本文介绍了如何使用变量传递数据库的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以动态方式传递数据库和SQL Server的源名称和目标名称。

我遵循的步骤是



1 。创建源数据库名称和目标名称的变量

的值我输入了数据库的名称。

SQL SOURce名称:XYZ

源数据库姓名:S1

SQL目的地:YYY

目的地数据库名称:D1



在属性中的连接管理器中表达式我想给连接字符串。我不知道在连接字符串中写什么。

解决方案

从这里开始: http:/ /www.connectionstrings.com/ [ ^ ]


Provider = SQLNCLI10.1; Data Source =+ @ [User :: SourceSQL] +; Integrated Security = SSPI; Initial Catalog =+ @ [User :: SourceDB] +;







这就是我使用字符串动态连接的方式。


I want to pass the source and destination names for database and SQL Server in dynamic manner.
Steps I followed is

1 . Created Variable for source database name and destination names
in values I have entered the name of database.
SQL SOurce name : XYZ
Source Database Name : S1
SQL Destination :YYY
Destination Database Name :D1

In connection manager in properties in expression I want to give connection string. I dnt know what to write in connection string.

解决方案

Start here : http://www.connectionstrings.com/[^]


"Provider=SQLNCLI10.1;Data Source="+ @[User::SourceSQL] +";Integrated Security=SSPI;Initial Catalog="+ @[User::SourceDB] +";"




This is how I used the string to connect dynamically.


这篇关于如何使用变量传递数据库的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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