Monday, March 12, 2012

Remote Query

Hi,
I would like to know why SQL Profiler return the output shown below and is
it possible to tune and avoid this problem?
declare @.P1 int
set @.P1=7
exec sp_prepexec @.P1 output, N'@.P1 varchar(255)', N'SELECT Tbl1019."Name"
Col1075,Tbl1019."PhoneNumber" Col1080,Tbl1019."Pager"
Col1081,Tbl1019."FirstName" Col1076,Tbl1019."LastName" Col1077 FROM "Users"
Tbl1019 WHERE @.P1=Tbl1019."Email"', 'aaa1@.test.com'
select @.P1
exec sp_execute 7, 'aaa2@.test.com'
exec sp_execute 7, 'aaa3@.test.com'
...
exec sp_execute 7, 'aaa10@.test.com'
If I have a page which need to display 10 users then it will show 10 times.
Thanks,
KennyThats the way your provider executes it at the SQLServer side, there is
AFAIK no way to change it, unless you code your Exec string on your own
in your application.
What data provider are you using ?
HTH, Jens Suessmeyer.|||I am not talking about any application but just the T-SQL.
You can simulate this problem by just setup 2 database server. DB1 have
users data. DB2 have Jobs data. You need to have a view vwUser in DB2 which
select the user data from DB1 e.g. FROM DB1.sd_db01.dbo.Users.
After that you try to execute SELECT * FROM vwUser and capture info from
profiler then you can see the problem.
Thanks,
Kenny
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1126854669.318346.268580@.g44g2000cwa.googlegroups.com...
> Thats the way your provider executes it at the SQLServer side, there is
> AFAIK no way to change it, unless you code your Exec string on your own
> in your application.
> What data provider are you using ?
> HTH, Jens Suessmeyer.
>

No comments:

Post a Comment