Viewing 15 posts - 2,476 through 2,490 (of 3,011 total)
Why not do it in one statement, so that is will execute in a single transaction?
insert into MyTable
( something, somethingelse, ...)
select
a.something,
b.somethingelse,
...
from
MyTable a,
MyTable b,
...
where
a.criteria = ...and
b.criteria = ... and so on
February 12, 2008 at 12:17 pm
You also need to init the value of @textNumber
This will generate the number without a loop:
declare @textNumber varchar(7)
set@textNumber =
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)+
right(abs(checksum(newid())%9)+1,1)
select@textNumber
February 12, 2008 at 11:56 am
chris.compton (2/12/2008)
I've been programming for almost two decades, and the terminology I...
February 12, 2008 at 9:56 am
I have used a hybrid approach: Write a procedure that generates the code to create static stored procedures. I have done exactly this for cases where we need to...
February 12, 2008 at 8:28 am
I won’t hash over the reasons for using identity surrogate keys; that has already been well expressed in this thread.
The real reason I don’t use natural primary keys is simple:...
February 12, 2008 at 7:54 am
Both methods are using an implicit cast of an integer to a datetime.
If the implicit cast of the integer to datetime stops working, then this will also stop working:
select DATEADD(dd,DATEDIFF(dd,0,Mydate),0)
It...
February 11, 2008 at 4:25 pm
toniupstny (2/11/2008)
February 11, 2008 at 12:25 pm
iceheartjade (2/5/2008)
Hi, all...no bad value will be insert into the tables...
I guess your organization, unlike where I work, has developers that never make mistakes.
February 5, 2008 at 2:09 pm
If you truncate the table before you start the load, the starting seed value of the identity column will reset to 1.
February 5, 2008 at 12:20 pm
You cannot restore a SQL 2005 backup onto a SQL 2000 server.
February 5, 2008 at 12:16 pm
This works in all versions of SQL Server with all regional settings, all settings of language, and all settings of datefirst.
select convert(datetime,'20080208')
If you are getting an error, if must be...
February 5, 2008 at 10:41 am
If you are running with mixed authtentication enabled, just switch the job to run as SA.
This also prevents you from having issues with domain authentication.
February 5, 2008 at 10:34 am
The format YYYYMMDD is the ideal way to format a date to insert into a SQL server datetime column, provided is is a string and not an integer.
February 5, 2008 at 10:29 am
select t1 = 10/100, t2 = 100/100, t3 = 10./100., t4 = 100./100.
Results:
t1 t2 ...
February 5, 2008 at 7:43 am
Viewing 15 posts - 2,476 through 2,490 (of 3,011 total)