Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    266

    Unanswered: Copy a column content in another one only if empty

    for MS SQL 2000

    table [Users] :
    [id_Users] [int] NOT NULL ,
    [Name] [varchar] (25) NOT NULL,
    [Alias] [varchar] (25) NULL

    how can I copy the content of [Name] into the column [Alias] only if [Alias] is Empty ?

    thank you

  2. #2
    Join Date
    Jun 2003
    Posts
    269

    Thumbs up Re

    Code:
    ---I ve consider null value also in this code.
    update Users
    set Alias=Name where Alias is null or ltrim(rtrim(Alias))=''
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  3. #3
    Join Date
    Dec 2005
    Posts
    266
    wonderfull !

    it works :-)

    thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •