开发者

A replicated SQL Server stored procedure returns different results

开发者 https://www.devze.com 2023-02-04 13:01 出处:网络
I had created a new stored procedure from an existing one. all I did was copy the old one and changed the name.

I had created a new stored procedure from an existing one. all I did was copy the old one and changed the name.

Now when i run both in the query an开发者_开发知识库alyzer, i get data from the original but the new one does not return any data.

It could be with permissions but both are set to public. Any thoughts?


check ansi-nulls value? they can casuse a headach. hard to tell without seeing the code but as a general debug rule; break it apart into its basic queryies and see where the issue is introduced or where it starts to diferentiate from results of the original stored sprocedure


Sorry if my question appears naïve, but... how did you actually make the copy?

I have only used SSMS to work with DBs so far and am oblivious of other interactive tools, if there are any. As to SSMS, a mere replicating is often done in this scenario: sp_helptext [proc name], then copying the output into a new query window, changing the name and voila (i.e. 'executing the script'). The permissions are peeked at in the original proc's properties and usually added using the same or a new script.

It seems so trivial that I feel a bit guilty to put it here. Anyway, that method has never failed me so far. What is yours then?

Sorry, this of course doesn't answer your particular problem with the already copied SP. I just thought maybe you wanted some help in the more fundamental problem of its replicating.


Creating script and re-replicating the sp worked. it could have been the proc's owner or permissions related. dont feel like debugging any more after I got that working.

0

精彩评论

暂无评论...
验证码 换一张
取 消