Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)

  • RE: SELECT * or Column Names

    Declare @ColumnList nvarchar(4000)

    SELECT @ColumnList = ISNULL(@ColumnList  + ',', '') + Column_Name+char(13)

       FROM INFORMATION_SCHEMA.Columns

      WHERE Table_Name = 'tablename'

      ORDER BY Ordinal_Position

    print @ColumnList

     

    Add a char(13) if you want a carriage return...

  • RE: Question of the Day for 02 Jun 2005

    This works, and is very straightforward:

     

    declare @var as varchar(100)

    set @var = '12312ASD435ASDah4ddASD123123'

     

    if (isnumeric(@var)=0)  --isnumeric return '0' false

          print 'yes'

    else

          print 'no'

     

     

    K.I.S.S Principle

  • RE: Update with zero

    Joejoe,

    Try this statement if the values are in one column:

    update YOURTABLE

    set YOURCOLUMN='0'+YOURCOLUMN

    or you can use this is you need to zeroes based upon the data

    update YOURTABLE

    set YOURCOLUMN=

          case

          when len(YOURCOLUMN)=?...

  • RE: table name as variable in sql

    Before posting this, let me first disclose that of course there are better design methods...there is more than one way to skin a cat.  However, in the "real world" sometimes...

Viewing 4 posts - 1 through 4 (of 4 total)