Viewing 15 posts - 106 through 120 (of 268 total)
Jay,
This is the code for the set based update statement:
declare @row int, @increment int, @start datetime, @update_count int
set @start = getdate()
set @row = 1
set @increment = 5000
set @update_count = 0
set...
July 30, 2003 at 7:53 am
I've been doing exactly the same over the last couple of days - trying to replace a cursor based update process with a set based process.
So far I am not...
July 30, 2003 at 3:04 am
If it is a simple replace all the content of the row with the new content, then you might consider deleting the row and then inserting the row. Performance...
July 25, 2003 at 8:32 am
How about using the length of the second column a the integer value in a right expression?
select a.col1...
from table_a left join table_b
on right(table_a.col1,length(table_a.col1)) = table_b.col1
....
If you have any trailing...
July 25, 2003 at 7:46 am
Something like this (Check it out in BOL):
update <master_Table>
set col1 = <temporary_table>.col1, col2 = <temporary_table>.col2 ....
from <master_table>, <temporary_table>
where <master_table>.<primary_key> = <temporary_table>.<primary_key>
I don't think you acutally...
July 25, 2003 at 7:39 am
A couple of extra points.
1. Do the updates before the inserts otherwise you end up updating the rows you have just inserted.
2. If you have 500K rows to...
July 25, 2003 at 7:23 am
One way is to import the file into a temporary table and then process that temporary table to insert or update records in the master table.
Depending on how complex the...
July 25, 2003 at 6:09 am
You can execute the file directly from a job (with the type set to Operating System Command):
start /normal <file_name> <parameters>
July 24, 2003 at 7:56 am
You might try seomthing like this:
/* User Defined Function to concatentate data */
create function [dbo].[fn_ListOfConditions] (@patientid varchar(25) )
returns varchar(255) as
begin
declare @string varchar(255)
set @string = ''
select @string = @string + vchrDesc...
July 24, 2003 at 7:13 am
If you want a single row at a time you can do this:
declare @string varchar(255), @col1_value varchar(25)
set @string = ''
set @col1_value = 'A'
select @string = @string + col2 + '...
July 24, 2003 at 2:51 am
Ilan,
I think what you want to do it to create a single variable with a list of users and then set that as @recipients.
Try this:
declare @recipient varchar(1000)
set @recipient = ''
select...
July 24, 2003 at 2:38 am
You can use @@rowcount to determine the number of rows affected by update statement.
You might want to put the value of @@rowcount into another variable as it may change with...
July 10, 2003 at 3:30 am
Greg,
What's the best way of making your code dynamic? I tried declaring a variable so that the query became:
declare @n int
set @n = 76
select top 1 salary from
(select...
July 8, 2003 at 3:13 am
One way to do this is to use a job. The user would initiate the job which would complete the user's transaction but the job would continue until it...
June 27, 2003 at 2:51 am
Viewing 15 posts - 106 through 120 (of 268 total)