Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How should I run "logics"?

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-03-20 : 10:40:51
Hello,

Consider the following logic sequence:
> If Exists (Record with given UserId and DocId in Reviews)
Update Review
Else
If UserdId exists in Users AND DocId exists in Docs
Create Review

Well, this might be more complex.

But my question are:

1. Should I create simple procedures like "UserExists", "DocExists" and then call them from the create procedure instead of having the code all in same place?
2. Should I call an Update procedure from my Create procedure instead of having all the code inside Create?

3. Finally, and maybe more important, should I call the procedures from my .NET code? Basically, I would create simple procedures and the decision logic would be create on my .NET code.

Thanks,
Miguel

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-03-20 : 11:28:46
I dont think its the complicated procedure.. you can do all your conditions in the single procedure..
well its better if you can handle this to the stored procedure rather then doing this in front end....

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-03-20 : 13:59:12
If you are going to use the same logic to check for users and docs in multiple procedures, then create these checks as user-defined functions.

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -