Forum Replies Created

Viewing 15 posts - 346 through 360 (of 395 total)

  • RE: SET IDENTITY_INSERT [dbo].[tblTransactions] ON

    Something like this?:

    USE [TrackIT]

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER TRIGGER [dbo].[trCreateTerminationRecord]

    ON [dbo].[tblTransactions]

    AFTER UPDATE

    AS

    BEGIN

    SET IDENTITY_INSERT tblTransactions ON

    INSERT INTO tblTransactions

    (tblTransactions.PO_Number,

    tblTransactions.Quantity,

    tblTransactions.Transaction_Type)

    SELECT

    INSERTED.PO_Number,

    INSERTED.Quantity,

    INSERTED.Transaction_Type

    FROM INSERTED

    WHERE Transaction_Type = 'Terminate...

  • RE: SET IDENTITY_INSERT [dbo].[tblTransactions] ON

    So is there a way of simply inserting a new record into a table with a PK via a trigger?

  • RE: SET IDENTITY_INSERT [dbo].[tblTransactions] ON

    Got this:

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER TRIGGER [dbo].[trCreateTerminationRecord]

    ON [dbo].[tblTransactions]

    AFTER UPDATE

    AS

    BEGIN

    SET IDENTITY_INSERT tblTransactions ON

    INSERT INTO tblTransactions

    (tblTransactions.PO_Number,

    tblTransactions.Quantity,

    tblTransactions.Transaction_Number,

    tblTransactions.Transaction_Type)

    SELECT

    INSERTED.PO_Number,

    INSERTED.Quantity,

    INSERTED.Transaction_Number,

    INSERTED.Transaction_Type

    FROM INSERTED

    WHERE Transaction_Type = 'Terminate SW'

    SET IDENTITY_INSERT...

  • RE: Trigger using @@IDENTITY

    So I can't have my trigger create a record to go in my tblTransactions and pick up the next available sequential number? I guess on my application side...

  • RE: Trigger using @@IDENTITY

    I'll study the second post, but to the first post - ignore my verbage about logs... it's not really a log... my transaction table gets records generated directly from purchases,...

  • RE: Trigger using @@IDENTITY

    I'm wanting the trigger to create a record and take the next number in the table's sequence.

  • RE: Trigger using @@IDENTITY

    Here's my DDL for my table:

    USE [TrackIT]

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_PADDING ON

    GO

    CREATE TABLE [dbo].[tblTransactions](

    [PO_Number] [varchar](50) NULL,

    [Buyer_Initial] [varchar](50) NULL,

    [Quantity] [int] NULL,

    [Unit_Price] [money] NULL,

    [Software_Description] [varchar](100) NULL,

    [AllocationAccount] [varchar](50) NULL,

    [PurchaseAccount] [varchar](50) NULL,

    [HeatTicketNumber] [varchar](50)...

  • RE: permissions issue

    Here is my DDL for the two tables so looks like I need to do some cleanup:

    CREATE TABLE [dbo].[Master](

    [Buyer_Initial] [varchar](50) NULL,

    [HeatTicketNumber] [varchar](50) NULL,

    [PO_Number] [varchar](50) NULL,

    [Transaction_Date] [date] NULL,

    [EndUserLastName] [varchar](100) NULL,

    [EndUserFirstName] [varchar](100)...

  • RE: permissions issue

    tried these variations to make sure syntax wasn't biting me:

    USE [TrackIT]

    GO

    set identity_insert tblTransactions ON

    GO

    INSERT INTO [dbo].[tblTransactions]

    (tblTransactions.Buyer_Initial,

    USE [TrackIT]

    GO

    set identity_insert tblTransactions ON;

    GO

    INSERT INTO [dbo].[tblTransactions]

    (tblTransactions.Buyer_Initial,

    USE [TrackIT]

    Set identity_insert tblTransactions ON;

    GO

    INSERT INTO [dbo].[tblTransactions]

    (tblTransactions.Buyer_Initial,

    USE [TrackIT]

    GO

    set identity_insert...

  • RE: permissions issue

    SET IDENTITY_INSERT [TrackIT].[dbo].[tblTransactions] ON worked as far as:

    "Command(s) completed successfully."

    But When I try to run my INSERT I get:

    "Msg 544, Level 16, State 1, Line 1

    Cannot insert explicit value for...

  • RE: permissions issue

    table exists and I routinely run commands like this which would indicate I have permissions (?):

    ALTER TABLE dbo.tblTransactions

    ADD TransferFrom VARCHAR(100) Null;

    GO

  • RE: Parsing First Middle Last name

    I can go with changing the first part to "SELECT LTRIM(SubString(CustomerName,-1" and that does the trick in this case

  • RE: Parsing First Middle Last name

    I've only found 5 out of 8,000 records which I simply hand scrubbed... all else were in stated format

  • RE: The multi-part identifier "Master.Buyer_Initial" could not be bound

    Yes correct schema... fully qualified is TrackIT dbo tblTransactions... and I'm in the correct database in which I can run queries, add fields, query my data, redefine datatypes, write triggers,...

  • RE: The multi-part identifier "Master.Buyer_Initial" could not be bound

    Tried loading my data and got the same error.

    Then tried SET IDENTITY_INSERT dbo.tblTransactions ON again and it said: Cannot find the object "dbo.tblTransactions" because it does not exist or...

Viewing 15 posts - 346 through 360 (of 395 total)