Results 1 to 4 of 4

Thread: information_schema.columns

  1. #1
    Join Date
    Mar 2003
    Posts
    383

    Wink information_schema.columns

    Hi:

    I need to change a column default to '' and not null for 1500 databases accross 10 servers.

    if exists (select * from information_schema.columns
    where table_name = 'tblABC'
    and column_name = 'columnX'
    and data_type = 'VARCHAR'
    and is_nullable = 'No'
    and column_default = '('')'
    )
    begin
    --do something to implement
    end

    Here, there is a problem for and column_default = '('')'
    I have tried ''''+'('')' + '''' or "'('')'", neither works.
    Do you have any idea to deal with the ('') ?

    thanks
    -D

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    use tempdb
    go
    create table tblABC(column1 int, columnX varchar(100) NOT NULL default "('')")
    go
    set quoted_identifier off
    go
    select * from information_schema.columns
    where table_name = "tblABC"
    and column_name = "columnX"
    and data_type = "VARCHAR"
    and is_nullable = "No"
    and column_default = "('('''')')"

  3. #3
    Join Date
    Mar 2003
    Posts
    383
    Hi MAK:
    It works.
    I just need to run the set quoted_identifier off first.

    thanks for the help.
    -D

  4. #4
    Join Date
    Mar 2003
    Posts
    383

    Cool

    MAK:

    This is derived question about information_schema.

    When I need to check a internal service pack is successfully installed or not, I could use information_schema for all changes with table, coulmn, datatype, size, nullable, default, fk constraint and other constraints.

    But how could i check triggers and proc which is not provided via information_schema? I still have to go through sysobjects?

    Worse, if it is with encryption option, it looks the crdate is the only indicator about when it is installed, might not be enough to me to verify it is ok. I hope there is a total size of bytes as another indicator for comparision.

    thanks
    -D

Posting Permissions

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