Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does it make sense to change this SP?
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01325771
Message ID:
01325774
Views:
15
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I've created the simplest SP to return one record back based on the RegistrationID
>
>select *, one extra field from myTable where ID = @ID
>
>However, I have questions:
>
>1. Does it make sense to add a check for the existance of the ID (what if somebody deletes this record while it was being requisted)? Good point, BTW, I need to add a flag Deleted = 0 to my select.
>
>2. Depending on PersonType I need to return only certain fields. Does it make sense to branch this SP to list only required fields (but then we would need to modify this SP often in case fields changed/added)
>
>What do you think here?
>
>Thanks in advance.

re: 1. If the ID doesn't exist you will get an empty table. I'd worry about it at the client end.

re: 2. Unless your table record is extraordinarily large, pulling * makes maintenance easier assuming ID is a primary or unique key.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform