Forum Replies Created

Viewing 15 posts - 1,921 through 1,935 (of 2,171 total)

  • RE: How to use multiple values in a single query parameter

    declare @ids varchar(5)

    SET @ids = '1,2'

    declare @sql varchar(1000)

    select @sql = 'SELECT SATA_AllocationObject.*, Id AS Expr1'

    select @sql = @sql + ' FROM SATA_AllocationObject'

    select @sql = @sql + ' WHERE Id IN ('...

  • RE: Server Jobs that are executing?

    Check out the MSDB database tables

    Sysjobs

    SysjobHistory

    SysjobSchedules

     

    SELECT * FROM msdb..sysjobs

    SELECT * FROM msdb..sysjobhistory

    SELECT * FROM msdb..sysjobschedules

  • RE: Incrementing a number in a string and Inserting a New record

    select MyField,

           stuff (

                     MyField,

                     8,

                     case

                         when charindex('&', MyField) = 0 THEN LEN(MyField)

                         ELSE charindex('&', MyField) - 8

                     end,

                     10 +  case

                               when charindex('&',

  • RE: Incrementing a number in a string and Inserting a New record

    Do you have sample data from your REAL table?

    It seems to me that you do not have "VIEWID=" first in every row, if any text at all is present.

    Run this...

  • RE: How many more Mondays until I retire?

    Yes, they are equally safe.

    The DATEDIFF(day, 0, GETDATE()) calculates the number of days passed since day Zero, which is January 1, 1900. This is what clips the time information.

    These number...

  • RE: Incrementing a number in a string and Inserting a New record

    No.

    Just copy this code and paste to you Query Analyzer.

    select MyField,

           stuff (

                     MyField,

                     8,

                     case

                         when charindex('&', MyField) = 0 THEN LEN(MyField)

                         ELSE charindex('&', MyField)...

  • RE: Incrementing a number in a string and Inserting a New record

    That is just for simulating your environment. I am populating my table variable with test data.

    -- Populate test data

    declare @a table (z nvarchar(100))

    insert @a

    select 'VIEWID=582' union...

  • RE: Incrementing a number in a string and Inserting a New record

    declare @a table (z nvarchar(100))

    insert @a

    select 'VIEWID=582' union all

    select 'VIEWID=582&PARAM1=A%25' union all

    select NULL

    select z,

           stuff (

                     z,

                     8,

                     case

                         when charindex('&', z) = 0 THEN LEN(z)

                         ELSE charindex('&', z) - 8

                    ...

  • RE: Beginner in Sql 2000

    This might give you an idea how to start

    -- Prepare test data

    declare @customers table (custid int, custname varchar(2))

    insert @customers

    select 1, 'AA' union all

    select 2, 'AB' union all

    select 3, 'C' union all

    select 4,...

  • RE: Primary key Violation Error In Cursor

    As the error says, you are trying to change a column that has a foreign key constraint to another table.

     

  • RE: How many more Mondays until I retire?

    Yes, R2ro's solution is fast. And if I change

    SET @daysDiff = DATEDIFF(day, @prmLoDate, @prmHiDate)

    to

    SET @daysDiff = 1 + DATEDIFF(day, @prmLoDate, @prmHiDate)

    it calculates the right days too.

    I...

  • RE: How many more Mondays until I retire?

    Good! Here is a guy who actually read the first part of the article where I wrote that a CROSS JOIN solution is the fastest solution