473,543 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Field List Returned as Data

NeoPa
32,563 Recognized Expert Moderator MVP
I have a table with a large number of fields associated. I'd like to run a query to return the names of all these fields as data, so I can use this later in other data manipulation queries.

I'm very rusty on SQL Server, so I expect a nudge in the right direction would be enough to get me going.
Mar 10 '10 #1
3 2225
NeoPa
32,563 Recognized Expert Moderator MVP
I'm using MS SQL Server Management Studio Express (2008) and after playing around for a while I found something that would have been much more obvious if I had done more work in this area recently.

Right click on the table of interest. Select Script Table as / SELECT to / New Query Editor Window. When the query is created it will list all the fields in the SELECT statement.
Mar 10 '10 #2
ck9663
2,878 Recognized Expert Specialist
If you want to retrieve the columns in a result set, you can use the INFORMATION_SCH EMA view. Try this, change the parameters as necessary:

Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from information_schema.columns
  3. where table_catalog = '<dbname>' and
  4. table_schema = '<ownername>' and table_name = '<tablename>'
Happy Coding!!!

~~ CK
Mar 10 '10 #3
NeoPa
32,563 Recognized Expert Moderator MVP
Thanks CK.

It's a work problem so I'll check it out tomorrow. It seems more flexible overall, so may be a better solution. I was chuffed to find that the automatic scripting does so much for you though. Definitely a bonus :)
Mar 10 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4280
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db...
20
10095
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
6
2935
by: NotGiven | last post by:
I want to learn moer of what I saw in a recent example. They create a page that created new fields/element. It's not like they were hidden and they displayed them, they were not there, then the script created them. It used things like parentnode, insertBefore, appendChildNode,... Any ideas/direction is appreciated.
8
7076
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: BattID VehicleID STDATE STTIME CTC LKO500HF 00000000 10/27/2003 4:13:51 AM 4 LKO500HF 00000000 10/27/2003 5:13:51 AM 5 LKO500HF 00000000 10/27/2003 10:13:51 AM 6...
4
1796
by: Martin Lacoste | last post by:
Can I get field names to be returned as data in a query's results? E.g. I have 3 fields (City, Town, Village), and want the results to incorporate these as data, e.g.: City 2 Town 4 Village 5 Town 3 City 9
7
2152
by: dam_fool_2003 | last post by:
friends, I wanted to learn the various ways of inserting a single list. so: Method 1: #include<stdlib.h> #include<stdio.h> struct node { unsigned int data; struct node *next;
0
3143
by: Pete Newman | last post by:
In running vs (vb ) .net 2005 and Sql 2005 On my form i have an oledbconnection, an oledbdataadapter and a dataset. when i try and do an update i get an error; 'Child list for field DebBacsfmDestAccs cannot be created' im at a loss as to how to resolve this .. i need help please code;
0
1257
by: =?Utf-8?B?RGF2ZSBU?= | last post by:
I have a list box that is bound to an object data source. I added a column, say ColumnC, to my typed data set (using the designer) and for the expression property I entered ColumnA + ': ' + ColumnB When I preview the data in the designer I get exactly what I want. Now I go over to the object data source on my web page, refresh it and...
10
10577
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
4
2713
by: Paul | last post by:
Hi all, I have a page that has a form on it which has a dropdown list on it. It connect to an sql database and populate the list. What I would like to do is make the list editable so that if the data returned doesnt contain what I want, I can type in the data I require which will then be updated to the database when the form is posted. ...
0
7408
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7590
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7688
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5885
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5271
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
968
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
636
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.