Forum Replies Created

Viewing 15 posts - 1 through 15 (of 17 total)

  • RE: Error MSG in Table Valued Func/Cursor

    Hi Lynn,

    I think the final query is. Yes I posted the result

    when I query the EditLog table

    SELECT *

    FROM dbo.EditLog AS EL

    WHERE EL.NoteText = 'change value from 30 to...

  • RE: Error MSG in Table Valued Func/Cursor

    Here is the final query for the view:

    SELECT NS.LocCode

    ,NS.LocationDesc

    ,NS.PrdName

    ,NS.ProductDescription

    ,NS.PkgCode

    ,VE.Label

    ,E.PlanId

    ,P.Description

    ,E.TransId

    ,E.EventTypeId

    ,CONVERT(INT,ROUND(SUM(E.Qty),0)) AS Quantity

    ,EL.Id

    ,EL.EditData

    ,EL.PlanId

    ,EL.TransId

    ,PP.PeriodLabel

    ,EL.EntityId

    ,CONVERT(INT,ROUND(SUM(EL.QtyPrior),0)) AS [Quantity Prior]

    ,EL.Description

    ,EL.NoteText

    FROM dbo.Event AS E

    INNER JOIN dbo.ADMC_DDL_GetUniqueEditLog() AS EL

    ON EL.PlanId = E.PlanId

    AND EL.TransId = E.TransId

    LEFT JOIN dbo.NodeSku AS...

  • RE: Error MSG in Table Valued Func/Cursor

    Your previous question - if this is the only value you want returned, is this based on PlanId, TransId, or EntityId? If there are different PlanIds, TransIds, or EntityIds what...

  • RE: Error MSG in Table Valued Func/Cursor

    This the result of the function: this is good

    SELECT * FROM dbo.ADMC_DDL_GetUniqueEditLog()

    3029 2013-01-08 15:00:21.91013144379005410 2160EDIT NULL

    838072015-04-24 10:25:58.42015206348842011500 10000EDIT

    I posted the...

  • RE: Error MSG in Table Valued Func/Cursor

    Lynn,

    Yes, something like your example that has (blah, change from 2 to 3.

    Here is the final query I'm working with.

    SELECT E.PlanId AS [Plan]

    ,P.[Description] AS [Plan Description]

    ,NS.LocCode AS [Location Code]

    ,NS.LocationDesc...

  • RE: Error MSG in Table Valued Func/Cursor

    Here is the create table statement

    CREATE TABLE [dbo].[EditLog_back](

    [Id] [INT] IDENTITY(1,1) NOT NULL,

    [EditDate] [DATETIME] NOT NULL,

    [PlanId] [INT] NOT NULL,

    [TransId] [INT] NOT NULL,

    [EntityId] [INT] NOT NULL,

    [QtyPrior] [FLOAT] NULL,

    [QtyAfter] [FLOAT] NOT NULL,

    [Description] [VARCHAR](255)...

  • RE: Error MSG in Table Valued Func/Cursor

    Here are some inserts

    INSERT INTO dbo.EditLog_back(EditDate,PlanId,TransId,EntityId,QtyPrior,QtyAfter,Description,NoteText)

    VALUES (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');

    INSERT INTO dbo.EditLog_back(EditDate,PlanId,TransId,EntityId,QtyPrior,QtyAfter,Description,NoteText)

    VALUES (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');

    INSERT INTO dbo.EditLog_back(EditDate,PlanId,TransId,EntityId,QtyPrior,QtyAfter,Description,NoteText)

    VALUES (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');

    INSERT INTO dbo.EditLog_back(EditDate,PlanId,TransId,EntityId,QtyPrior,QtyAfter,Description,NoteText)

    VALUES...

  • RE: Error MSG in Table Valued Func/Cursor

    Lynn,

    I included some data from the EditLog table in previous post.

    I get the following error when creating the function

    Msg 4514, Level 16, State 1, Procedure ADMC_DDL_GetUniqueEditLog, Line 25

    CREATE FUNCTION...

  • RE: Error MSG in Table Valued Func/Cursor

    Hi Gail,

    Here is the DDL table

    ALTER FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog]()

    RETURNS @EditLog TABLE(

    Id INT NOT NULL

    ,EditDate DATETIME NOT NULL

    ,PlanId INT NOT NULL

    ,TransId INT NOT NULL

    ,EntityId INT NOT NULL

    ,QtyPrior FLOAT NULL

    ,QtyAfter FLOAT NOT NULL

    ,Description...

  • RE: Table Valued Function

    Lynn, this is the table.

    CREATE TABLE [dbo].[EditLog](

    [Id] [INT] IDENTITY(1,1) NOT NULL,

    [EditDate] [DATETIME] NOT NULL,

    [PlanId] [INT] NOT NULL,

    [TransId] [INT] NOT NULL,

    [EntityId] [INT] NOT NULL,

    [QtyPrior] [FLOAT] NULL,

    [QtyAfter] [FLOAT] NOT NULL,

    [Description]...

  • RE: Table Valued Function

    Thank Lowell, please advise what will be the best field(s) to group by.

  • RE: Table Valued Function

    Thanks Lowell, please advise what will be the best field(s) to group by.

  • RE: Table Valued Function

    here is some some records. all are same records but the edit time are different. I would like to have a cursor or something else that can through the...

  • RE: Table Valued Function

    CREATE FUNCTION dbo.ADMC_DDL_GetUniqueEditEdit()

    RETURNS @EditLog TABLE(

    Id INT NOT NULL

    ,EditDate DATETIME NOT NULL

    ,PlanId INT NOT NULL

    ,TransId INT NOT NULL

    ,EntityId INT NOT NULL

    ,QtyPrior FLOAT NULL

    ,QtyAfter FLOAT NOT NULL

    ,Description VARCHAR(255) NULL

    ,NotText NVARCHAR(max) NULL

    )

    AS

    BEGIN

    INSERT INTO...

  • RE: Table Valued Function

    SELECT Empid,

    STUFF (

    (

    ...

Viewing 15 posts - 1 through 15 (of 17 total)