Forum Replies Created

Viewing 15 posts - 46 through 60 (of 74 total)

  • RE: Linked Server Query.

    Hi,

    I'm not sure exactly how the query is executed. Some simple queries might be run on the remote server and only the answer is returned. But rather quick you will...

  • RE: Complicated Quey help

    Does this give you the result you want?

    declare @t table (Item_no int , stock1 int,stock2 int ,date datetime )

    insert into @t

    select 0001 ,5 ,5 ,'2010-01-01' union select...

  • RE: FOR XML EXPLICIT Question

    I did solve it using FOR XML EXPLICIT, but I'm not sure it's the best option here. The problem with EXPLICIT is that you need to know how many levels...

  • RE: how to compare values with main query and sub query

    Hi Bob,

    It's not clear what you want. If you want no of orders placed on a particular date, you would need to either add the date in the select clause...

  • RE: Trigger help

    Hi Chris,

    perhaps you can do something like this:

    declare @StoreRows table (caseid int)

    -- Make a list of all rows inserted

    insert into @StoreRows

    select caseid -- or what key column you have

    from inserted

    if...

  • RE: Trigger help

    Hi Chris,

    It's not a good idea to "accept the insert" and not store all the rows inserted. Better to either accept the insert with all rows or reject the whole...

  • RE: Creating a Trigger on 2 tables

    You can't have one trigger for two tables, but you should be able to use two (sligtly different) triggers on the two tables.

    Perhaps something like this:

    create trigger myTableATrigger on TableA

    for...

  • RE: Nested Case Statement Alternative/Rule Engine

    This is a start, can probably be done even more.

    select

    Case When not Isnull(val1,'N') = 'N' Then 1 -- previously issued an check

    ...

  • RE: Mapping column name with a column value

    Hi,

    you could use a Tally-table to solve the problem:

    CREATE TABLE #TABLE_FROM

    (

    ID INT,

    A1 VARCHAR(100),

    A2 VARCHAR(100),

    A3 VARCHAR(100),

    A4 VARCHAR(100)

    )

    INSERT INTO #TABLE_FROM VALUES (1, '65656515', 'Male', 'Allan', 'Iverson');

    INSERT INTO #TABLE_FROM VALUES...

  • RE: error handling

    Use a TRY ... CATCH block:

    BEGIN TRY

    EXEC Revnue.RevEmpAgg.[dbo].[usp_insertempcount] @empid,@jobrole,@startdate

    EXEC msdb.dbo.sp_send_dbmail -- Send success mail

    END TRY

    BEGIN CATCH

    EXEC msdb.dbo.sp_send_dbmail -- Send failure...

  • RE: Split one field into multiple using a delimiter

    Imu, I didn't see your post until after I posted my solution..

    From now on, I will look for a Tally-solution first, before trying with a loop (or cursor)... 😉

    /Markus

  • RE: Split one field into multiple using a delimiter

    Here is one way to solve the problem:

    declare @STR varchar(200)

    set @STR = 'Apple, Banana,Orange, Pinapple, Lemon'

    declare @result table (string varchar(100))

    declare @start int

    declare @end int

    set @start =...

  • RE: Varbinary To VarChar

    You can, but you need to take care about nul-values (i.e. ASCII NUL = char(0).), because these seem to act as string terminator:

    declare @bin varbinary(20)

    -- Converting to and from binary

    set...

  • RE: Need help to insert value into 3 table

    Hi,

    you have switched the columns in the insert statements, change to:

    insert into tripD( tripH_trnxid, wday) values(@ID, '1011010')

    insert into tripD( tripH_trnxid, wday) values(@ID , '1111110')

    Then everything will work as expected.

    /Markus

  • RE: Delete Records

    Hi Gail,

    GilaMonster (2/20/2010)


    Hunterwood (2/16/2010)


    It´s allways a good rule of thumb to use TOP 1 together with EXISTS, because it prevents the database engine from doing unneccesary work.

    Got an example that...

Viewing 15 posts - 46 through 60 (of 74 total)