Viewing 15 posts - 166 through 180 (of 291 total)
Ok, I wanted to make sure. Yes you need to alter the code I posted as follows:
DELETE ContactResp
WHERE kContactNameID IN (SELECT ContactNameID
FROM inserted i JOIN deleted d...
June 6, 2007 at 7:00 am
Sorry, PK is short for "Primary Key" (if the table PK is a composit of two or more columns adjust the join statement accordingly)
Since I did not know the...
June 6, 2007 at 6:29 am
The nice thing about the second solution is you can implemnt the "Least" function with only a couple of additonal lines of code:
create function dbo.Least_ (@parmlist_ as varchar(4000))
returns int
as
begin
...
June 5, 2007 at 2:15 pm
While I generally shy away from tokenized string parameters, the following will do what you want without resorting to the sp_exectuesql.
NOTE: I obtained the "split" function from a script posted...
June 5, 2007 at 1:47 pm
Adam: Guess I should have used the word "accuracy" (either that or learn how to spell! [veracity]). I'm far from and expert in this area and didn't want to steer...
June 5, 2007 at 12:23 pm
It is my understanding that the if UPDATE(columnname) evalutes to true if any record in the result set had that column modified/inserted. So your delete statement would include all rows...
June 5, 2007 at 11:14 am
While I can not vouch for the complete voracity veracity of the information provided at: http://www.sommarskog.se/error-handling-I.html I found the article very informative and useful. I stumbled accross it while looking...
June 5, 2007 at 11:00 am
Thanks Shawn, wish I could take full credit but all I did was "Find" the answer as it already existed elsewhere. Credit has to go to Erland Sommarskog who put...
June 5, 2007 at 10:58 am
Hate to do this to you, but it depends on the error, and sometimes the context of the error. Funny you should ask this today, as it was part of the...
June 5, 2007 at 10:48 am
I thought this would be "prettier" than it actually is because I didn't realize that unlike stored procedures, optional parameters in functions can't actually be ignored. But this might give...
June 5, 2007 at 7:39 am
If a table is referenced by a subordinate table you can not use the truncate table command even if the subordinate tables are empty. You will have to use a...
June 4, 2007 at 10:15 am
Since the relationships are there for a reason you should respect them and delete the subordinate data first. These relationships prevent you from orphaning data in subordinate tables which would...
June 4, 2007 at 9:36 am
This solution uses a Common Table Expression (CTE) and it will find all related no matter how deep, though I can't figure out how to make it work using the...
June 1, 2007 at 11:48 am
Here is a simple solution based on information given. Doesn't work if more than one level deep.
--Build our test data
if object_id('tempdb..#temp_') is not null drop table #temp_
create table #Temp_ (guid_id...
June 1, 2007 at 10:22 am
Interesting idea, I never considered that possibility. Thanks for a great example that really helps illustrate the concept.
James.
June 1, 2007 at 10:02 am
Viewing 15 posts - 166 through 180 (of 291 total)