Thank you for your replay.
I have simulated what you did originally to get the error and got the same results.
I have tried option one to declare the '0000-......' value but it does not seem to filter through to the SQL(It stays NULL).
I have tried setting the value manually in the sql by using the profiler out put of my call and adding the value. I get a int-char convertion error.
declare @P1 int
set @P1='00000000-0000-0000-0000-00000000000'
declare @P2 int
set @P2=0
declare @P3 int
set @P3=4098
declare @P4 int
set @P4=8200
declare @P5 int
set @P5=0
exec sp_cursorprepexec @P1 output, @P2 output, N'@P1 char(36)', N'SELECT TSTGUID, NUM FROM dbo.P63llV WHERE ( ( TSTGUID >= @P1 ) ) ORDER BY TSTGUID ', @P3 output, @P4 output, @P5 output, '00000000-0000-0000-0000-00000000000 '
select @P1, @P2, @P3, @P4, @P5
Server: Msg 245, Level 16, State 1, Line 2
Syntax error converting the varchar value '00000000-0000-0000-0000-00000000000' to a column of data type int.
Is it correct that the @P1 gets defined as int should it not be Char? If I change it from int to char it I get the error :
Server: Msg 16902, Level 16, State 29, Procedure sp_cursorprepexec, Line 11
sp_cursorprepexec: The value of parameter 'cursor' is invalid.
I am working on option 2 but the alternate key is not 100% of the time unique and I need to do updates on that selected data too so that will cause problems later on.