Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find out number of fields
Message
From
30/01/2010 03:59:24
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01446547
Message ID:
01446619
Views:
31
>>>>Hi everybody,
>>>>
>>>>I have a long select statement and I'm wondering how can I find number of fields returned by it without writing to a real table?
>>>>
>>>>Also, since I'm getting the result into VFP cursor, I guess I need to limit the number of fields to 254, correct?
>>>>
>>>>Thanks.
>>>
>>>You have a long SELECT?
>>>Are you using a some kind of macro/execscript?
>>>
>>>Because if you don't you may check the number of the fields after the cursor is created, if you do you could parse the string between SELECT and FROM and check how many commas are there.
>>
>>I don't think the number of commas is the way to go
>
>Why?

There may be functions (with arguments separated by commas) in the select.
Counting the number of commas would not give the right result
select left(field,2) as xx
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform