Forum Replies Created

Viewing 15 posts - 61 through 75 (of 156 total)

  • RE: How to run same script in multiple databases at one shot

    Check out sp_MSforeachdb

    EXEC master.dbo.sp_MSforeachdb 'use [?] select db_name() '

  • RE: Split function input be column of a table

    Using Charindex and Substring functions will return just a single value. The split function returns a table

    If I do a Split function as select * from dbo.split('4;5;6',';') I get...

  • RE: Comparing MS SQL Schema

    I have used SQL Compare from Redgate. It's a neat tool and also generate SQL scripts for the differences in the Schema. There is a 14-day trial version available.

    For...

  • RE: Group By - Help

    Thanks John. That worked.

  • RE: Group By - Help

    This would return 2 rows for each of ColA and ColDescription.

    130 3D0041-1 Receptacle       123;456;111

    130 3D0041-1 Receptacle       3322;2233;111

    130 9D0062-1-08-10 Bracket   12;32;77

    130 9D0062-1-08-10 Bracket   12;3254;77

    I need either of rows in red and...

  • RE: Group By - Help

    It does not matter - any row with the least occurance would work.

  • RE: Group By - Help

    I have to give credit to Igor from where I got this function.

    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,27115

    CREATE function OCCURS(@cSearchExpression nvarchar(4000), @cExpressionSearched nvarchar(4000))

    returns smallint

    as

        begin

             return

               case 

                  when datalength(@cSearchExpression) > 0

                  then  ...

  • RE: Group By - Help

    Thanks John. I have a Split functions that return the number of times ';' repeats. How will the query work with the split function ? The query has to return the...

  • RE: USE DB with a variable

    Execute this from a database other than Northwind.

    DECLARE @DBName varchar(100), @sqlStr varchar(1000)

    SET @DBName = 'NorthWind'

    SET @sqlstr = 'USE ' + @DBName + ';'

    SET @sqlstr = @sqlstr + 'SELECT COUNT(*)...

  • RE: LEFT JOIN question

    Try this

    SELECT count(distinct a.ColumnA) FROM A LEFT JOIN B ON A.ID = B.ID LEFT JOIN C ON A.ID = C.ID

    Change ColumnA to any column from table A.

  • RE: UDF question

    Thanks David. That worked.

  • RE: UDF question

    SELECT  PositionID FROM Employee WHERE  ID = 5 returns only one row. ID is the primary key for Employee table.  The error I get when I execute the query

    SELECT...

  • RE: UDF question

    Thanks for your replies.

    Remi, why is it a cursor if a function from a select that does a select from the same/different table? Is that like a normal Inner...

  • RE: how to get multiple occurences of a particular substring in a string

    You will have to use a function. Here is a good article that I found - look for OCCURS function

    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,27115

     

  • RE: Can we rename a DTS Package

    Open the DTS package, do a Save As with the new name and delete the old package. Note that the new package will have just the latest version of the...

Viewing 15 posts - 61 through 75 (of 156 total)