Forum Replies Created

Viewing 15 posts - 196 through 210 (of 287 total)

  • RE: T-sql search condition

    There are no system tables being triggered, so you should be fine.

  • RE: T-sql search condition

    I was messing around a bit since I haven't mess with DDL triggers before.. this seems to work:ALTER TRIGGER Test

    ON DATABASE

    FOR CREATE_TABLE

    AS

    IF NOT EXISTS

    (

    ...

  • RE: T-sql search condition

    Not 100% sure about being able to do the check in a trigger. As far as I know you can get at the CREATE statement.. But, then I think you'd...

  • RE: T-sql search condition

    Untested, but something like this I think will work:SELECT

    *

    FROM

    INFORMATION_SCHEMA.TABLES AS T

    LEFT OUTER JOIN

    (

    SELECT

    Table_Name

    FROM

    INFORMATION_SCHEMA.COLUMNS

    WHERE

    DATA_TYPE = 'datetime'

    AND IS_NULLABLE = 'NO'

    AND

    (

    Column_Name = 'creation_date'

    OR Column_Name = 'last_modified_date'

    )

    GROUP BY

    Table_Name

    HAVING...

  • RE: TRY CATCH & RAISEERROR

    It's been a while since I set up my stored procedure template with error handling, but I *think* you need to use the ERROR_NUMBER() function inside the CATCH block. But,...

  • RE: PK violation but still a commitable transaction

    I don't see any need to get XACT_ABORT on for that code. It should fail on the PK violation and jump to the CATCH. Unless I'm missing something thing..?

    SET XACT_ABORT...

  • RE: replace values of rows and update with preset value

    UPDATE ScoreTable

    SET sore_id = sore_id + 13107

  • RE: Which on is the Best option???

    I've run into instances where and NOT LIKE are not necessarily the same (actually, = and LIKE). Here is an example, possibly more obscure than any real data. But,...

  • RE: Best Practice Error Handling / Linked Server Queries...

    I can't answer your question directly as I do not have much experience with linked servers, and frankly I do not like them. But, you might want to look into...

  • RE: Maths equation

    The main issue is the substring: SELECT substring(@data_nv,1,10)

    Maybe this will help:declare @data_nv nvarchar(500)

    declare @data_numeric DECIMAL(15,2)

    SET @data_nv = '2.0018430861853059e-005'

    SELECT CAST(@data_nv AS FLOAT)

    SELECT CAST(CAST(@data_nv AS FLOAT) AS DECIMAL(38,25))

    SELECT CAST(CAST(CAST(@data_nv AS FLOAT) AS...

  • RE: LinkedServer - still mystified

    @SQL (7/21/2009)

    The problem with linkedservers in SQl 2005 is that it first copies the data into a temp table on local server and then to your base table which makes...

  • RE: Remaining Time Calculation

    Can you explaine how you calcualted those values? I'm totaly missing how you go them.

  • RE: Looking For Duplication

    What is your expected output?

    See if this works for you:SELECT

    DISTINCT O2.*

    FROM

    tmpOrders AS O1

    INNER JOIN

    tmpOrders AS O2

    ON O1.RecordID O2.RecordID

    AND O1.ProductID = O2.ProductID

    AND O1.OrderDate = O2.OrderDate

    AND O1.ProductClass = O2.ProductClass

    AND...

  • RE: if qty_requested =8 then display the information 8 times.

    If I understand you you could use a Numbers/Tally table and join to that.. For example:-- SET UP

    DECLARE @Numbers TABLE (Num INT)

    INSERT @Numbers

    SELECT 1

    UNION ALL SELECT 2

    UNION ALL SELECT 3

    UNION...

  • RE: Problem with Query

    Hehe, I was goofing around and came up with a solution, albeit poor, that works for the sample data. YMMV:DECLARE @TABLE2 TABLE (NewPart_No int,OldPartNo int,Sno int IDENTITY(1,1))

    INSERT INTO @TABLE2(NEWPART_NO,OLDPARTNO) VALUES(1,3)

    INSERT...

Viewing 15 posts - 196 through 210 (of 287 total)