Forum Replies Created

Viewing 15 posts - 2,476 through 2,490 (of 3,011 total)

  • RE: When to use SET ISOLATION LEVEL SERIALIZABLE?

    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

  • RE: Concatenate numbers to form a 7 digit string

    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

  • RE: The Identity Debate

    chris.compton (2/12/2008)


    Okay, with the risk of sounding more ignorant than I am, I'll admit that I get a little lost.

    I've been programming for almost two decades, and the terminology I...

  • RE: Compare two Identical tables

    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...

  • RE: The Identity Debate

    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:...

  • RE: Datediff usage

    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...

  • RE: How to convert varchar data type to TABLE data type?

    toniupstny (2/11/2008)


    You could partition the tables so that Query Optimizer can pick which table to go against depending on the value of the year. For each year, create...

  • RE: Avoiding lookups for exsitence

    Do you have a question?

  • RE: pro and con about foreign key constraint

    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.

  • RE: Creating sql tables thru scripts or stored procedures

    If you truncate the table before you start the load, the starting seed value of the identity column will reset to 1.

  • RE: 2005 backups vs 2000 backups

    You cannot restore a SQL 2005 backup onto a SQL 2000 server.

  • RE: insert YYYYMMDD into Date field

    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...

  • RE: Job failed:The owner does not have server access.

    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.

  • RE: insert YYYYMMDD into Date field

    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.

  • RE: My Percentage calculation is bringing out 0's and 1's

    select t1 = 10/100, t2 = 100/100, t3 = 10./100., t4 = 100./100.

    Results:

    t1 t2 ...

Viewing 15 posts - 2,476 through 2,490 (of 3,011 total)