April 28, 2015 at 9:03 am
I received the following when constructing the below table valued function with cursor.
My attempt is to loop through the EditLog table and return the most up to date change based on the date. Here is the code: Thanks for all the help.
CREATE FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog_test]()
RETURNS VARCHAR(255)
AS
BEGIN
DECLARE @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
,NoteText NVARCHAR(MAX) NULL
)
INSERT INTO @EditLog
(Id
,EditDate
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,Description
,NoteText)
SELECT EL.Id
,EL.EditDate
,EL.PlanId
,EL.TransId
,EL.EntityId
,EL.QtyPrior
,EL.QtyAfter
,EL.Description
,EL.NoteText
FROM dbo.EditLog AS EL
DECLARE @EditLog_CURSOR CURSOR FOR
SELECT EL.Id
,EL.EditDate
,EL.PlanId
,EL.TransId
,EL.EntityId
,EL.QtyPrior
,EL.QtyAfter
,EL.Description
,EL.NoteText
FROM @EditLog AS EL
OPEN @EditLog_CURSOR
FETCH NEXT FROM @EditLog_CURSOR;
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM @EditLog_CURSOR;
END
CLOSE @EditLog_CURSOR;
DEALLOCATE @EditLog_CURSOR;
END
Here is the error
Msg 156, Level 15, State 1, Procedure ADMC_DDL_GetUniqueEditLog_test, Line 37
Incorrect syntax near the keyword 'FOR'.
Msg 444, Level 16, State 2, Procedure ADMC_DDL_GetUniqueEditLog_test, Line 49
Select statements included within a function cannot return data to a client.
Msg 444, Level 16, State 2, Procedure ADMC_DDL_GetUniqueEditLog_test, Line 52
Select statements included within a function cannot return data to a client.
April 28, 2015 at 9:12 am
If you could post the DDL of the EditLog table and some sample data (as insert statements), I'm sure someone will be able to rewrite that without the cursor and get it running faster than an average glacier (which is what that function will currently do on a moderate-sized table)
btw, that isn't a table-valued function. It returns VARCHAR(255), which makes it a scalar function. Since there's no return statement, it'll return NULL. It's throwing an error because you have a SELECT inside the cursor and functions aren't allowed to have SELECTs which return data within them.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 28, 2015 at 9:27 am
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 VARCHAR(255) NULL
,NoteText NVARCHAR(MAX) NULL
)
AS
BEGIN
INSERT INTO @EditLog
(Id
,EditDate
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,Description
,NoteText)
SELECT EL.Id
,MAX(EL.EditDate)
,MAX(EL.PlanId)
,MAX(EL.TransId)
,MAX(EL.EntityId)
,MAX(EL.QtyPrior)
,MAX(EL.QtyAfter)
,MAX(EL.Description)
,MAX(EL.NoteText)
FROM dbo.EditLog AS EL
GROUP BY EL.Id;
RETURN;
END
data from the Editlog table
IdEditDatePlanIdTransIdEntityIdQtyPriorQtyAfterDescriptionNoteText
834532015-04-21 21:25:46.057152063526918116.15384615384618.33333333333333EDITchange from 48 to 25
834542015-04-21 21:25:46.587152063526988116.15384615384618.33333333333333EDITchange from 48 to 25
834552015-04-21 21:25:46.720152063526953116.15384615384618.33333333333333EDITchange from 48 to 25
834562015-04-21 21:34:11.11015206352691818.3333333333333333.3333333333333EDITchange from 25 to 100
834572015-04-21 21:34:11.21715206352698818.3333333333333333.3333333333333EDITchange from 25 to 100
834582015-04-21 21:34:11.30715206352695318.3333333333333333.3333333333333EDITchange from 25 to 100
834592015-04-21 21:36:59.007152063526918133.333333333333350EDITChange from33.3 to 50
837652015-04-23 19:42:19.51715206353236810.6578947368421050.789473684210526EDITchange from 18 to 25
837662015-04-23 19:42:19.64315206353250810.6578947368421050.789473684210526EDITchange from 18 to 25
837672015-04-23 19:42:19.74015206353209810.6578947368421050.789473684210526EDITchange from 18 to 25
837682015-04-23 19:42:19.88315206353218310.6578947368421050.789473684210526EDITchange from 18 to 25
837692015-04-23 19:42:20.00015206353191410.6578947368421050.789473684210526EDITchange from 18 to 25
837702015-04-23 19:42:20.14715206353257810.6578947368421050.789473684210526EDITchange from 18 to 25
837712015-04-23 19:42:20.36715206353261610.6578947368421050.789473684210526EDITchange from 18 to 25
April 28, 2015 at 9:44 am
forrest77 (4/28/2015)
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 VARCHAR(255) NULL
,NoteText NVARCHAR(MAX) NULL
)
AS
BEGIN
INSERT INTO @EditLog
(Id
,EditDate
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,Description
,NoteText)
SELECT EL.Id
,MAX(EL.EditDate)
,MAX(EL.PlanId)
,MAX(EL.TransId)
,MAX(EL.EntityId)
,MAX(EL.QtyPrior)
,MAX(EL.QtyAfter)
,MAX(EL.Description)
,MAX(EL.NoteText)
FROM dbo.EditLog AS EL
GROUP BY EL.Id;
RETURN;
END
data from the Editlog table
IdEditDatePlanIdTransIdEntityIdQtyPriorQtyAfterDescriptionNoteText
834532015-04-21 21:25:46.057152063526918116.15384615384618.33333333333333EDITchange from 48 to 25
834542015-04-21 21:25:46.587152063526988116.15384615384618.33333333333333EDITchange from 48 to 25
834552015-04-21 21:25:46.720152063526953116.15384615384618.33333333333333EDITchange from 48 to 25
834562015-04-21 21:34:11.11015206352691818.3333333333333333.3333333333333EDITchange from 25 to 100
834572015-04-21 21:34:11.21715206352698818.3333333333333333.3333333333333EDITchange from 25 to 100
834582015-04-21 21:34:11.30715206352695318.3333333333333333.3333333333333EDITchange from 25 to 100
834592015-04-21 21:36:59.007152063526918133.333333333333350EDITChange from33.3 to 50
837652015-04-23 19:42:19.51715206353236810.6578947368421050.789473684210526EDITchange from 18 to 25
837662015-04-23 19:42:19.64315206353250810.6578947368421050.789473684210526EDITchange from 18 to 25
837672015-04-23 19:42:19.74015206353209810.6578947368421050.789473684210526EDITchange from 18 to 25
837682015-04-23 19:42:19.88315206353218310.6578947368421050.789473684210526EDITchange from 18 to 25
837692015-04-23 19:42:20.00015206353191410.6578947368421050.789473684210526EDITchange from 18 to 25
837702015-04-23 19:42:20.14715206353257810.6578947368421050.789473684210526EDITchange from 18 to 25
837712015-04-23 19:42:20.36715206353261610.6578947368421050.789473684210526EDITchange from 18 to 25
Here is a rewrite of your function, but it is untested as there was no DDL for the table used in the function and no sample data provided as a series of INSERT INTO statements to put data into the table used by the function. Please let us know if this helps.
DROP FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog];
go
CREATE FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog]()
RETURNS TABLE WITH SCHEMABINDING
RETURN
SELECT
EL.Id
,MAX(EL.EditDate)
,MAX(EL.PlanId)
,MAX(EL.TransId)
,MAX(EL.EntityId)
,MAX(EL.QtyPrior)
,MAX(EL.QtyAfter)
,MAX(EL.Description)
,MAX(EL.NoteText)
FROM
dbo.EditLog AS EL
GROUP BY
EL.Id;
go
April 28, 2015 at 9:48 am
Aside of what Gail has already mentioned, the other reason for your error is
DECLARE @EditLog_CURSOR CURSOR FOR
is bad, it should be
DECLARE @EditLog_CURSOR CURSOR
SET @EditLog_CURSOR = CURSOR FOR
SELECT EL.Id
I was just playing and did this, but I wasn't sure what you were trying to achieve
If OBJECT_ID('tempdb..#EditLog') is not null
Drop table #EditLog
Create table #EditLog (
Id int identity not null, EditDate datetime, PlanId int, TransId Int
,EntityId int ,QtyPrior int, QtyAfter int
,Description nvarchar(4000), NoteText nvarchar(max))
Insert into #EditLog Values(GetDate(), 1, 1, 1, 1, 2, 'blah', 'blah blah blah')
Declare @Id int, @EditDate datetime, @PlanId int, @TransId Int
,@EntityId int ,@QtyPrior int, @QtyAfter int
,@Description nvarchar(4000), @NoteText nvarchar(max)
DECLARE @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
,NoteText NVARCHAR(MAX) NULL
)
INSERT INTO @EditLog
(Id
,EditDate
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,Description
,NoteText)
SELECT EL.Id
,EL.EditDate
,EL.PlanId
,EL.TransId
,EL.EntityId
,EL.QtyPrior
,EL.QtyAfter
,EL.Description
,EL.NoteText
FROM #EditLog AS EL
DECLARE @EditLog_CURSOR CURSOR
SET @EditLog_CURSOR = CURSOR FOR
SELECT EL.Id
,EL.EditDate
,EL.PlanId
,EL.TransId
,EL.EntityId
,EL.QtyPrior
,EL.QtyAfter
,EL.Description
,EL.NoteText
FROM @EditLog AS EL
OPEN @EditLog_CURSOR
FETCH NEXT FROM @EditLog_CURSOR INTO @Id, @EditDate, @PlanId, @TransId
,@EntityId, @QtyPrior, @QtyAfter, @Description, @NoteText;
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM @EditLog_CURSOR INTO @Id, @EditDate, @PlanId, @TransId
,@EntityId, @QtyPrior, @QtyAfter, @Description, @NoteText;
END
CLOSE @EditLog_CURSOR;
DEALLOCATE @EditLog_CURSOR;
April 28, 2015 at 9:55 am
I'm still not certain why you would find all the maxes. Wouldn't you want something like this?
If OBJECT_ID('tempdb..#EditLog') is not null
Drop table #EditLog
Create table #EditLog (
Id int identity not null, EditDate datetime, PlanId int, TransId Int
,EntityId int ,QtyPrior int, QtyAfter int
,Description nvarchar(4000), NoteText nvarchar(max))
Insert into #EditLog Values(GetDate(), 1, 1, 1, 1, 2, 'blah', 'Change from 1 to 2')
Insert into #EditLog Values(GetDate(), 1, 1, 1, 2, 3, 'blah', 'Change from 2 to 3')
Select EL.Id,EL.EditDate,EL.PlanId,EL.TransId,EL.EntityId
,EL.QtyPrior,EL.QtyAfter,EL.Description,EL.NoteText
From #EditLog EL
Where EditDate in (select MAX(EditDate) From #EditLog)
Returns:
22015-04-28 11:52:18.35311123blahChange from 2 to 3
April 28, 2015 at 9:57 am
Really need the DDL for the table(s), sample data as insert into statements, and expected results based on the sample data.
April 28, 2015 at 10:05 am
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 failed because a column name is not specified for column 2.
Basically this is what I am trying to accomplish
I plan to create a view which require that I take attributes from the Editlog table (e.g., QtyPrior, NoteText) but I only want the most up to date line (which should one line) from the EditLog table.
April 28, 2015 at 10:10 am
forrest77 (4/28/2015)
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 failed because a column name is not specified for column 2.
Basically this is what I am trying to accomplish
I plan to create a view which require that I take attributes from the Editlog table (e.g., QtyPrior, NoteText) but I only want the most up to date line (which should one line) from the EditLog table.
Okay, so add column name aliases for each of the MAX(...) function calls. That is an easy fix.
DROP FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog];
go
CREATE FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog]()
RETURNS TABLE WITH SCHEMABINDING
RETURN
SELECT
EL.Id
,MAX(EL.EditDate) EditData
,MAX(EL.PlanId) PlanId
,MAX(EL.TransId) TransId
,MAX(EL.EntityId) EntityId
,MAX(EL.QtyPrior) QtyPrior
,MAX(EL.QtyAfter) QtyAfter
,MAX(EL.Description) [Description]
,MAX(EL.NoteText) NoteText
FROM
dbo.EditLog AS EL
GROUP BY
EL.Id;
go
As for the data you posted, please, try to cut and paste that into a non existent table in a sandbox database. We need the DDL (CREATE TABLE statement) for the table and the data needs to be in the form of INSERT INTO statements to allow us to cut, paste and execute to load the table after we run the DDL to create the table.
Also, we need to know what the final results are supposed to be base on the sample data you provide.
April 28, 2015 at 10:20 am
forrest77 (4/28/2015)
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 VARCHAR(255) NULL
,NoteText NVARCHAR(MAX) NULL
)
AS
BEGIN
INSERT INTO @EditLog
(Id
,EditDate
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,Description
,NoteText)
SELECT EL.Id
,MAX(EL.EditDate)
,MAX(EL.PlanId)
,MAX(EL.TransId)
,MAX(EL.EntityId)
,MAX(EL.QtyPrior)
,MAX(EL.QtyAfter)
,MAX(EL.Description)
,MAX(EL.NoteText)
FROM dbo.EditLog AS EL
GROUP BY EL.Id;
RETURN;
END
data from the Editlog table
IdEditDatePlanIdTransIdEntityIdQtyPriorQtyAfterDescriptionNoteText
834532015-04-21 21:25:46.057152063526918116.15384615384618.33333333333333EDITchange from 48 to 25
834542015-04-21 21:25:46.587152063526988116.15384615384618.33333333333333EDITchange from 48 to 25
834552015-04-21 21:25:46.720152063526953116.15384615384618.33333333333333EDITchange from 48 to 25
834562015-04-21 21:34:11.11015206352691818.3333333333333333.3333333333333EDITchange from 25 to 100
834572015-04-21 21:34:11.21715206352698818.3333333333333333.3333333333333EDITchange from 25 to 100
834582015-04-21 21:34:11.30715206352695318.3333333333333333.3333333333333EDITchange from 25 to 100
834592015-04-21 21:36:59.007152063526918133.333333333333350EDITChange from33.3 to 50
837652015-04-23 19:42:19.51715206353236810.6578947368421050.789473684210526EDITchange from 18 to 25
837662015-04-23 19:42:19.64315206353250810.6578947368421050.789473684210526EDITchange from 18 to 25
837672015-04-23 19:42:19.74015206353209810.6578947368421050.789473684210526EDITchange from 18 to 25
837682015-04-23 19:42:19.88315206353218310.6578947368421050.789473684210526EDITchange from 18 to 25
837692015-04-23 19:42:20.00015206353191410.6578947368421050.789473684210526EDITchange from 18 to 25
837702015-04-23 19:42:20.14715206353257810.6578947368421050.789473684210526EDITchange from 18 to 25
837712015-04-23 19:42:20.36715206353261610.6578947368421050.789473684210526EDITchange from 18 to 25
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 do you want?
837712015-04-23 19:42:20.36715206353261610.6578947368421050.789473684210526EDITchange from 18 to 25
April 28, 2015 at 10:20 am
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 (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');
April 28, 2015 at 10:26 am
Something like this:
DROP FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog];
go
CREATE FUNCTION [dbo].[ADMC_DDL_GetUniqueEditLog]()
RETURNS TABLE WITH SCHEMABINDING
RETURN
WITH BaseData as (
SELECT
EL.Id,
EL.EditDate EditData,
EL.PlanId PlanId,
EL.TransId TransId,
EL.EntityId EntityId,
EL.QtyPrior QtyPrior,
EL.QtyAfter QtyAfter,
EL.Description [Description],
EL.NoteText NoteText,
rn = row_number() over (partition by EL.PlanId order by EL.EditDate desc)
FROM
dbo.EditLog AS EL
)
SELECT
Id
,EditData
,PlanId
,TransId
,EntityId
,QtyPrior
,QtyAfter
,[Description]
,NoteText
FROM
BaseData
WHERE
rn = 1;
go
-- Run the code:
select * from [dbo].[ADMC_DDL_GetUniqueEditLog];
April 28, 2015 at 11:02 am
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) NULL,
[NoteText] [NVARCHAR](MAX) NULL
) ON [PRIMARY]
GO
here is the insert statement
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 (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');
April 28, 2015 at 11:31 am
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 AS [Location Description]
,NS.PrdName AS [Product Code]
,NS.ProductDescription AS [Product Description]
,NS.PkgCode AS [Package Code]
,NS.PkgName AS [Package Description]
,VE.Label AS [Event Name]
,CONVERT(INT,ROUND(SUM(E.Qty),0)) AS Quantity
,NS.PrdFld12 AS [Unit of Measure]
,PP.PeriodLabel AS [Period]
,CONVERT(INT,ROUND(SUM(ADEL.QtyPrior),0)) AS [Quantity Prior]
,ADEL.NoteText AS [Note]
FROM [dbo].[Event] AS E
LEFT JOIN dbo.ADMC_DDL_GetUniqueEditLog() AS ADEL -- Table Valued Function created
ON ADEL.PlanId = E.PlanId
AND ADEL.TransId = E.TransId
INNER JOINdbo.NodeSku AS NS
ON E.NodeId = NS.NodeId
INNER JOIN dbo.ViewElements AS VE
ON VE.Id = E.EventTypeId
INNER JOIN dbo.Plans AS P
ON P.PlanId = E.PlanId
INNER JOIN dbo.PlanPeriod AS PP
ON PP.CalendarId = P.CalendarId
AND PP.PeriodId = E.TimePeriod
WHERE E.EventTypeId IN (300703,300000, 300001)
AND p.PlanId =15
AND E.Qty <> 0
AND PP.PeriodEnd >=GETDATE()
GROUP BY E.PlanId
,P.[Description]
,NS.LocCode
,NS.LocationDesc
,NS.PrdName
,NS.ProductDescription
,NS.PkgCode
,NS.PkgName
,VE.Label
,NS.PrdFld12
,PP.PeriodLabel
,NoteText
April 28, 2015 at 11:44 am
forrest77 (4/28/2015)
Here is the create table statementCREATE 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) NULL,
[NoteText] [NVARCHAR](MAX) NULL
) ON [PRIMARY]
GO
here is the insert statement
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 (GETDATE(),15,2063526918,1,16.1538461538461,8.33333333333333,'EDIT','change from 48 to 25');
Expected results?? Where does the query I provided miss the mark? What about the questions I asked as well, any answers?
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply