Forum Replies Created

Viewing 15 posts - 1,591 through 1,605 (of 3,543 total)

  • RE: Stored procedure problem

    As far as I can tell the insert will always take place as @RetCode is never set to zero because you

    declare @InvoiceCheck and @InvoiceDetailCheck but do not set their values...

  • RE: Determining first unit total by month window

    Don't know about slick but

    SELECT MyGroup,MIN(MyMonth) AS [MyMonth]

    FROM (SELECT a.MyGroup,a.MyMonth,SUM(b.MyUnits) As [MyUnits]

    FROM #MyHistory a

    INNER JOIN #MyHistory b

    ON b.MyGroup = a.MyGroup

    AND b.MyMonth >= a.MyMonth AND...

  • RE: Sum or aggregate operation......

    What is the delimiter for the csv file (hard to tell from the post)

    The data you posted is formatted as 6 char columns (although one maybe date) before the numbers,...

  • RE: Programming Regular Expressions

    Unless there is more complex validation, I would not use regx, I would

    create errormicrtable to contain invalid data

    create micrtable containing valid MICR codes

    and use the following to validate and test...

  • RE: Merging 3 statements to 1

    The update statement I posted will retrieve the latest value (@before), update the value (+1) and retrieve the new value (@after) in one go.

    I presume you want the current value...

  • RE: Merging 3 statements to 1

    What is the purpose of ldoclock, is it to stop other processes updating the record

    What do the values 0 and 1 for ldoclock indicate

    How many rows are there in wdoctyp...

  • RE: quoted identifiers in stored procedure

    Avoid the use of double quotes and use single quotes

    select 'exec sp_dropuser ' + '''' + [name] + '''' from sysusers where sid > 0x01 and (isntuser = 1 or...

  • RE: Table joining question. I want to join these two tables into this result. Can anyone help me?

    It works for me

    Are you sure you are creating  and using the two temp tables and inserting your current data into them...

  • RE: Table joining question. I want to join these two tables into this result. Can anyone help me?

    DECLARE @TableA TABLE (rowid int IDENTITY(1,1),portid ...)

    INSERT INTO @TableA (portid,acid,adDate,adTime,adPort,adType)

    SELECT portid,acid,adDate,adTime,adPort,adType FROM [TableA] ORDER BY portid ASC

    DECLARE @TableB TABLE (rowid int IDENTITY(1,1),portid ...

    INSERT INTO @TableB (portid,acid,adDate,adTime,adPort,adType)...

  • RE: sp_executesql and result set

    Yes, lookup sp_executesql in BOL

    Your example would like like this

    DECLARE @count int

    EXEC sp_executesql N'SELECT @count = count(*) FROM mytable', N'@count int output', @count OUTPUT

    SELECT @count

    Although you do...

  • RE: String occurence in a ntext column

    quoteI'm confused when you say Charindex can't be used on this datatype

    Because CHARINDEX only works with short 'character...

  • RE: Last update/insert

    Add a timestamp column to the table

    and use

    SELECT TOP 1 * FROM  ORDER BY [timestampcolumn] DESC

    to find the last row inserted or updated

     

  • RE: String occurence in a ntext column

    One way

    SELECT COUNT(*)

    FROM a

    INNER JOIN [Number] n

    ON SUBSTRING(a.[ntextcolumn],n.N,3) = N'xyz'

    AND n.N < (DATALENGTH(a.x) / 2)

    providing number table contains numbers upto max len of column

    not...

  • RE: Grouping, eliminate un-matched pairs?

    You could try this

    SELECT pid,part,dos,MAX(post) AS [post],DATEDIFF(day,dos,MAX(post)) AS [lag],SUM(volume),SUM(charges)

    FROM

    GROUP BY pid,dos,part

    HAVING SUM(charges) <> 0

    It will give you the greatest lag for pid,part,dos and since you...

  • RE: Grouping, eliminate un-matched pairs?

    quote...with the table I want all data from (a) on the left side of the '='...

    My preference is...

Viewing 15 posts - 1,591 through 1,605 (of 3,543 total)