Hi Cindy
Yes, I was just saying that to Himlar. I had tried to circumvent this by the following
SELECT STR(newid('CUSTPAYMENT'),15) as cId FROM wotscont
which theoretically should give it the size. Note also that I am not even using the same table here. When I run this my counter jumps 3 at a time. This is somewhat mystifying but by putting a trace on I can see that two temporary cursors are created.
Do you know how I can create a view that returns a result from a stored procedure. this is basically what I am trying to do.
regards
Geoff Scott
>>Hi Hilmar
>>
>>
SELECT IIF(not table='CUSTPAYMENT',999999999999,newid('CUSTPAYMENT')) as nextid ;
>> FROM ids WHERE table='CUSTPAYMENT' INTO CURSOR tNextId
>>
>>
>>executes the stored procedure twice even though there is only one record in with table='CUSTPAYMENT'
>
>Hi Geoff,
>
>The stored procedure runs at least twice. The first time around is to determine the maximum size of the resulting value so the column definition will be big enough for the whole value, and the following time(2) is when the SQL statement runs against the data.
May all your weeds be wildflowers