| Author |
Topic |
|
muek
Starting Member
16 Posts |
Posted - 2009-01-05 : 06:45:00
|
| Hi,I would like to know if it's possible to create a procedure, where we pass 2 arguments, the databases where the search must be done and how to use those parameters in select clausemuek |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-05 : 06:49:17
|
Yes you can.create proc dbo.uspMySearch(@param1 int,@param2 int)asset nocount onselect *from table1where (@param1 is null or @param1 = col1)and (@param2 is null or @param2 = col2) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
muek
Starting Member
16 Posts |
Posted - 2009-01-05 : 07:26:21
|
I didn't explain myself.What I would like to know is if it's possible something like:create proc dbo.uspMySearch(@database1 nvarchar(50),@database2 nvarchar(50))asset nocount onselect *from @database1.dbo.table1UNIONselect *from @database2.dbo.table1 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
muek
Starting Member
16 Posts |
Posted - 2009-01-05 : 08:47:40
|
| Hi Peso,you are right, it's a bad design, but the real use of this question will be to compare 2 databases and report the differences between them.Do you have any solutions for that question?Anything good in the Internet good and free?muek |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-05 : 09:02:10
|
quote: Originally posted by muek Hi,I would like to know if it's possible to create a procedure, where we pass 2 arguments, the databases where the search must be done and how to use those parameters in select clausemuek
why does you've to select db's dynamically? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-05 : 09:15:26
|
quote: Originally posted by muek Hi Peso,you are right, it's a bad design, but the real use of this question will be to compare 2 databases and report the differences between them.Do you have any solutions for that question?Anything good in the Internet good and free?muek
http://msdn.microsoft.com/en-us/library/aa833428(VS.80).aspx |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|