Forum Replies Created

Viewing 12 posts - 2,446 through 2,458 (of 2,458 total)

  • RE: SQL Variable IF Clause

    I think this is what you are looking for:

    DECLARE @d1int = 1,

    @v-2 varchar(2);

    DECLARE @table1 TABLE

    (

    idint,

    col2varchar(2)

    );

    DECLARE @table2 TABLE

    (

    idint,

    col2varchar(2)

    );

    INSERT INTO @table1

    VALUES (1,'aa'),(2,'bb'),(3,'d*')

    INSERT INTO @table2

    VALUES (1,'xx'),(2,'yy'),(3,'zz')

    SELECT @v-2 = col2 FROM @table1 WHERE...

  • RE: Urgent help needed, Max Growth by DB

    You mean 128. Yes, that is correct. Thanks!

  • RE: Urgent help needed, Max Growth by DB

    To get the number in MB:

    value * 8 / 1024

    Example:

    Selectname,

    size*8/1024

    from sys.master_files

  • RE: Urgent help needed, Max Growth by DB

    Everything except for the DB name can be found in sys.database_files. You can get db name with DB_NAME(). The procedure below will get you all this information for every DB...

  • RE: Searching Database for spesific column in all tables

    Beginning with SQL Server 2005, they included the INFORMATION_SCHEMA which is a better way to access this kind of information.

    For columns you can use INFORMATION_SCHEMA.COLUMNS which, unlike sys.columns, provides the...

  • RE: Searching Database for spesific column in all tables

    I also concur with Richard Warr's post. Redgate has a great tool for searching databases and the contents of databases (something worth noting, especially on SQLServerCentral.)

  • RE: Searching Database for spesific column in all tables

    If we are talking about searching for tables specifically here then you could use these:

    The first one, usp_findColumn_thisDB, takes a parameter and searches all tables with a column matching that...

  • RE: Removing possible bad Indexes

    With a couple very rare exceptions (not relevant for this conversation) I have never had any issues with disabling indexes.

  • RE: Removing possible bad Indexes

    Based on what you've said I cannot see any use for them but I would I would disable them first for a little while to be on the safe side...

  • RE: Removing possible bad Indexes

    Determining the performance impact of removing these unused indexes is important; understanding the impact of leaving them there is also important. In the past 14 years I cannot recall a...

  • RE: Need SQL queries please for string patterns

    I started with the first few:

    Create Sample Data:

    CREATE table x(Value varchar(20))

    INSERT INTO x VALUES

    ('a'),

    ('A'),

    ('NULL'),

    ('NULL xxx'),

    ('113Y'),

    ('111Y'),

    ('1')

    -- 1. string starts with 3 digit same number Example 111Y,333Y, 555 H etc

    -- a....

  • RE: Presenting rows of data horizontally

    This is a very interesting quandary indeed. I am sure this can be done using a little less code but here is what I came up with:

    SET NOCOUNT ON

    GO

    /***********************************************************************

    1) Create...

Viewing 12 posts - 2,446 through 2,458 (of 2,458 total)