SQL server sql question

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

SQL server sql question

Post by JPalatianos »

Hi,
We have a developer who exceutes the following fine as an SQl statement in query tools.
###############################################
BEGIN
SET NOCOUNT ON;

DECLARE @EventIDRecordType VARCHAR(26);
DECLARE @Name VARCHAR(256);
DECLARE @Members VARCHAR(3000);
DECLARE @Current_EventIDRecordType VARCHAR(26);

DECLARE @tmptbl TABLE (EventID VARCHAR(18), RecordType VARCHAR(8), Members VARCHAR(3000));
DECLARE mbr_cursor cursor FOR
SELECT eventid+recordtype, Name
FROM dbo.PruforceEventAttendee
ORDER BY 1, 2;


OPEN mbr_cursor;
FETCH NEXT FROM mbr_cursor INTO @EventIDRecordType, @Name;

SET @Current_EventIDRecordType = ' ' ;
SET @Members = '' ;

WHILE @@FETCH_STATUS = 0
BEGIN
IF @EventIDRecordType != @Current_EventIDRecordType
BEGIN
IF @Current_EventIDRecordType != ' '
INSERT INTO @tmptbl
VALUES(substring(@Current_EventIDRecordType,1,18), substring(@Current_EventIDRecordType,19,8), @Members);
SET @Current_EventIDRecordType = @EventIDRecordType;
SET @Members = RTRIM(@Name);
END
ELSE
SET @Members = @Members + ', ' + RTRIM(@Name);

FETCH NEXT FROM mbr_cursor INTO @EventIDRecordType, @Name;
END

INSERT INTO @tmptbl
VALUES(substring(@Current_EventIDRecordType,1,18), substring(@Current_EventIDRecordType,19,8), @Members);

CLOSE mbr_cursor;
DEALLOCATE mbr_cursor;

SELECT * FROM @tmptbl;
END

###############################################
When he pastes this in the user defined SQl field in the ODBC enterprise edition he receives the error:

main_program: [IBM (DataDirect OEM) ][ODBC SQL Server Driver][SQL Server]Line 2: Incorrect syntax near 'OFF'.

Followed by:
xfmCombineAttendees: Error when checking operator: Could not find input field "EventID".

We ahve never tried this type of SQl before and wondering if this should work.

Thanks - - John
Last edited by JPalatianos on Wed Feb 02, 2011 12:29 pm, edited 1 time in total.
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Post by JPalatianos »

My profile is showing as Server but this is a parallel job.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can edit your post and correct that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you sure you're referring to the correct procedure? After all, the one you posted does not contain "OFF".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JPalatianos
Premium Member
Premium Member
Posts: 306
Joined: Wed Jun 21, 2006 11:41 am

Post by JPalatianos »

That's what I found to be odd...there is no "OFF" in the User defined SQl. I have created my own version of the job to verify.
Post Reply