473,507 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table columns

My asp.net pages allow the user to add additional columns to an SQL table

Is there an SQL statement that I can use to return the number of columns
that the table currently has?

Netnatter

Sep 30 '08 #1
4 933
Hi netnatter,

Starting investigation from 'SELECT COUNT(*) FROM <table>' might be a good
point.

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
My asp.net pages allow the user to add additional columns to an SQL
table

Is there an SQL statement that I can use to return the number of
columns that the table currently has?

Netnatter

Sep 30 '08 #2
"Alex Meleta" <am*****@gmail.comwrote in message
news:df*************************@news.microsoft.co m...
Starting investigation from 'SELECT COUNT(*) FROM <table>' might be a good
point.
How will that help the OP to return the number of *COLUMNS* in his
datatable...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 30 '08 #3
"netnatter" <ne*******@ntlworld.comwrote in message
news:TV*******************@newsfe03.ams2...
Is there an SQL statement that I can use to return the number of columns
that the table currently has?
SELECT
COUNT (*) AS intColumns
FROM
sys.tables AS t
INNER JOIN sys.columns AS c ON t.object_id = c.object_id
WHERE
t.name = '<table>'
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 30 '08 #4
After serious thinking netnatter wrote :
My asp.net pages allow the user to add additional columns to an SQL table

Is there an SQL statement that I can use to return the number of columns that
the table currently has?

Netnatter
SELECT * FROM <tableWHERE 1=0

this doesn't return any rows, but does return the structure of the
table. Fill a DataSet with it and you can investigate the Columns.

Hans Kesting
Sep 30 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

61
24396
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
10
12703
by: VA | last post by:
I got the following function to swap table columns from somewhere on the Internet function swapColumns (table, colIndex1, colIndex2) { if (table && table.rows && table.insertBefore && colIndex1...
7
10791
by: Bing Wu | last post by:
Hi Folks, I have a very large table containing 170 million rows of coordinats: CREATE TABLE "DB2ADMIN"."COORDINATE" ( "FID" INTEGER NOT NULL , "AID" INTEGER NOT NULL , "X" REAL NOT NULL ,...
4
15797
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
15
2123
by: kimi | last post by:
I have just started working on a project that is partially complete. It is an application that is using access to store test results. The test results are being stored in two Access 2000 databases....
1
7332
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do...
117
18411
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
4
3701
by: Hemant Shah | last post by:
Folks, Our client has a program that browses whole table from begining to end. The table has 1 million rows in it. REORGCHK does not show any problems. It has unique index defined on KEY0...
5
3815
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
7
12037
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
7223
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,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
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,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7488
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...
0
4702
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...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
412
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...

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.