Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 is too long. Maximum length is 128.

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-06-25 : 10:24:43
hi
have this sql for an ssis package but getting the following error
Msg 103, Level 15, State 4, Line 1
The identifier that starts with 'INSERT INTO [dbo].[SSISLog]
([EventType]
,[PackageName]
,[TaskName]
,[EventCode]' is too long. Maximum length is 128.


here is my code
"INSERT INTO [dbo].[SSISLog]
([EventType]
,[PackageName]
,[TaskName]
,[EventCode]
,[EventDescription]
,[PackageDuration]
,[ContainerDuration]
,[InsertCount]
,[UpdateCount]
,[DeleteCount]
,[Host])

VALUES
(
'OnPostExecute',
'"+@[System::PackageName]+"',
'"+@[System::TaskName]+"',
0,
'"+@[System::SourceDescription]+"',
"+ (DT_STR, 6, 1252)DATEDIFF("ss", @[System::StartTime] , GETDATE() ) + ",
"+ (DT_STR, 6, 1252)DATEDIFF("ss", @[System::ContainerStartTime] , GETDATE() ) + ",
411,
2,
12,
'"+ @[System::MachineName] +"'
)
"


anyone any ideas why this is happening

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-25 : 10:30:23
where are you putting this statement? in Execute sql task?

you may be better off creating a variable and setting this as the expression for it and set its EvaluateAsExpression property true

Then in Execute sql task for the SourceType use Variable option and map it to above created variable

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-06-25 : 10:33:09
ya putting it into execute task. have never ever done this before and was following the following tutorial
http://consultingblogs.emc.com/jamiethomson/archive/2005/06/11/SSIS_3A00_-Custom-Logging-Using-Event-Handlers.aspx
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-06-25 : 11:01:31
getting this error now any ideas
[Execute SQL Task] Error: Executing the query "INSERT INTO [dbo].[SSISLog]
([EventType..." failed with the following error: "Conversion failed when converting the varchar value '"+ (DT_STR, 6, 1252)DATEDIFF("ss", @[System::StartTime] , GETDATE() ) + "' to data type int.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 02:22:39
your dynamic string is wrong. it should be


"INSERT INTO [dbo].[SSISLog]
([EventType]
,[PackageName]
,[TaskName]
,[EventCode]
,[EventDescription]
,[PackageDuration]
,[ContainerDuration]
,[InsertCount]
,[UpdateCount]
,[DeleteCount]
,[Host])

VALUES
(
'OnPostExecute',
'"+@[System::PackageName]+"',
'"+@[System::TaskName]+"',
0,
'"+@[System::SourceDescription]+"',
DATEDIFF(ss, " + (DT_STR, 6, 1252)@[System::StartTime] + " , GETDATE() ),
DATEDIFF(ss," + (DT_STR, 6, 1252)@[System::ContainerStartTime] + ", GETDATE() ),
411,
2,
12,
'"+ @[System::MachineName] +"'
)
"


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -