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 2000 Forums
 SQL Server Development (2000)
 Complex Stored Procedure to me

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-29 : 08:47:34
Jeff writes "Hi,

I am new to stored procedures and I will try to make this as clear as possible. If you need the code for the stored procedure I can send it. I have worked for hours on this and can't seem to figure out how to accomplish this.

I have an application that has two (of many) legs that deal with my profession. In the same table there is a flag to determine an entity type, for this let's say ent1 and ent2. All the fields are populated for both entities in the same table and are related to each other by an ID that both entities share. I have to pull records from one entity resultset where the entity type = ent1 and records from the other entity type where entity type = ent2 and have them in one table. This would be easy if there were two different tables holding this information. I also must do this in one stored procedure. What is hard is that the ArrivalDate field for ent1 is for ent1 and the ArrivalDate field for ent2 is different but I must have both dates in one resultset in one procedure. I have to search the field to make sure the Entitytype field does not contain %filter% and then the second entity I have to make sure the filter I just filtered out then becomes what I want. So the WHERE statement for each has to be different with one set of SELECT components. This is a third party app that I have to use and have no control over structures. Please help.

Again, if you need to see my stored procedure how I have it I can send it. I keep getting syntax errors.

SQL Server 2005 - no clue on updates.

Jeff"

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-03-29 : 09:17:55
>>I keep getting syntax errors.

No one can help you with syntax errors without seeing the code. What the error says would be helpfull as well...

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -