[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Scalar function question

Mark Goldin

3/13/2007 1:31:00 PM

Can I declare a cursor in a scalar-valued function?

Thanks


4 Answers

Uri Dimant

3/13/2007 1:39:00 PM

0

Mark
You can create WHILE loop ,perhaps if you would explain what are you trying
to achive we would give you a better suggetion





"Mark Goldin" <mgoldin@ufandd.com> wrote in message
news:%23a5WePXZHHA.1580@TK2MSFTNGP05.phx.gbl...
> Can I declare a cursor in a scalar-valued function?
>
> Thanks
>


Mark Goldin

3/13/2007 1:55:00 PM

0

DECLARE ProcessScan CURSOR FAST_FORWARD FOR

select ReadingTime from udf_GetAllJobScansUser(@Job, @User_id)

order by id

I am getting an error:

Select statements included within a function cannot return data to a client.

"Uri Dimant" <urid@iscar.co.il> wrote in message
news:O%23FrqUXZHHA.3928@TK2MSFTNGP03.phx.gbl...
> Mark
> You can create WHILE loop ,perhaps if you would explain what are you
> trying to achive we would give you a better suggetion
>
>
>
>
>
> "Mark Goldin" <mgoldin@ufandd.com> wrote in message
> news:%23a5WePXZHHA.1580@TK2MSFTNGP05.phx.gbl...
>> Can I declare a cursor in a scalar-valued function?
>>
>> Thanks
>>
>
>


Uri Dimant

3/13/2007 2:02:00 PM

0

Mark
First of all try to avoid operate with the tables in Scalar UDF, it may hit
performance
Secondaly, can you show the source of UDF?



"Mark Goldin" <mgoldin@ufandd.com> wrote in message
news:%232UrscXZHHA.208@TK2MSFTNGP05.phx.gbl...
> DECLARE ProcessScan CURSOR FAST_FORWARD FOR
>
> select ReadingTime from udf_GetAllJobScansUser(@Job, @User_id)
>
> order by id
>
> I am getting an error:
>
> Select statements included within a function cannot return data to a
> client.
>
> "Uri Dimant" <urid@iscar.co.il> wrote in message
> news:O%23FrqUXZHHA.3928@TK2MSFTNGP03.phx.gbl...
>> Mark
>> You can create WHILE loop ,perhaps if you would explain what are you
>> trying to achive we would give you a better suggetion
>>
>>
>>
>>
>>
>> "Mark Goldin" <mgoldin@ufandd.com> wrote in message
>> news:%23a5WePXZHHA.1580@TK2MSFTNGP05.phx.gbl...
>>> Can I declare a cursor in a scalar-valued function?
>>>
>>> Thanks
>>>
>>
>>
>
>


Mark Goldin

3/13/2007 2:02:00 PM

0

Never mind I had a select statement in a few lines down.

"Mark Goldin" <mgoldin@ufandd.com> wrote in message
news:%232UrscXZHHA.208@TK2MSFTNGP05.phx.gbl...
> DECLARE ProcessScan CURSOR FAST_FORWARD FOR
>
> select ReadingTime from udf_GetAllJobScansUser(@Job, @User_id)
>
> order by id
>
> I am getting an error:
>
> Select statements included within a function cannot return data to a
> client.
>
> "Uri Dimant" <urid@iscar.co.il> wrote in message
> news:O%23FrqUXZHHA.3928@TK2MSFTNGP03.phx.gbl...
>> Mark
>> You can create WHILE loop ,perhaps if you would explain what are you
>> trying to achive we would give you a better suggetion
>>
>>
>>
>>
>>
>> "Mark Goldin" <mgoldin@ufandd.com> wrote in message
>> news:%23a5WePXZHHA.1580@TK2MSFTNGP05.phx.gbl...
>>> Can I declare a cursor in a scalar-valued function?
>>>
>>> Thanks
>>>
>>
>>
>
>