By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 4,516 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

Sql Stored Procedure

P: 37
I have 3 tables that I'm working with in Sql Reporting Services. tblParks, tblContacts, tblZone.

I want to say: If "ContactID" IS NULL in tblParks THEN get "ZoneCoordinator" in tblZones.

How would I write this in Sql? Would I write it as a stored procedure?
Jun 6 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 2,878
What's the key that linked these tables?

-- CK
Jun 7 '08 #2

Expert 100+
P: 1,134
Here is how you do the use this field but if its null use another.
I don't know how the tables should join as you don't provide enough info

Expand|Select|Wrap|Line Numbers
  1. SELECT isnull(tblParks.ContactID,tblZones.ZoneCordinator) as FieldName
  2. FROM TheTablesAndJoinConditionsNescessaryToProduceYourRequirements

If you need to pass parameters to the query for use in a WHERE clause then use a stored procedure. If no parameters (ie. the WHERE clause,if used, never changes) then use a view.
Jun 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.