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)
 Adding and Deleting tables

Author  Topic 

dawillia
Starting Member

2 Posts

Posted - 2004-07-23 : 15:03:03
Is it good practice to add and remove tables in a stored procedure?

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-07-23 : 15:05:37
temp tables yes. I would not want to add or drop 'real' tables from a sproc though.

What exactly are you wanting to do? With a little background info, we can help you work out your code.



-ec
Go to Top of Page

dawillia
Starting Member

2 Posts

Posted - 2004-07-23 : 16:07:22
This is what I am trying to do, and I am not sure of what is the best solution. I have an input parameter which is a delimited string.
I want to loop through that string, get the values, then do a search in a table (about 15 records). I heard that looping through comma delimited string in sql is time consuming. So, I thought about loading the string on a table and matching its values against other table.

In other words:

These are the values that could be on the table.
fldStatus = 'CR,CL,,PD........'

This is the string I want to loop through
MyString = 'DE,KI,FG,CR,KJ,CL'

When the loop for MYString hits the index for CR, I want to stop the loop, and get that record. Once it finds the first match I want to stop the loop. . I don't want the match for CL since CR is priority.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-23 : 16:35:26
You're going to need some user defined functions...I'll see hwat I can dig up...

Come Monday....

It'll be alright....

Margarita TIME!



Brett

8-)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-24 : 00:43:52
what tells you that you want to stop at CR? Are there other values you would stop at?

Kristen
Go to Top of Page
   

- Advertisement -