473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

T-SQL automatic resizing of columns in table

I work with very large CSV files which contain demographic information on people which is pulled into T-SQL and manipulated. The output is eventually sent to a DBASE IV file to be place into a mail sort program we use. By default the column width is set to 8000. What I would like to obtain is a procedure which automatically determine all the columns in a table (varies from database to database). Then checks for the maximum field width (SELECT max(len(<column name>)) FROM <Table Name>)and automatically trims the column to that width if greater than 8 and makes it 8 for anything less than 8 or NULL.

Example

NAME_1 TITLE
Bill Grateful CEO
Lawrence Welch
George Buches PRES
Donald Trumpy CEO

In this case there are 2 columns NAME_1 and TITLE

The longest name in column called NAME_1 is Lawrence Welch at 14 characters so I want column NAME_1 set to a width of 14.

The longest name in column called TITLE is Pres at 4 characters so I want column TITLE set to a width of 8.
May 24 '07 #1
0 1209

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

Similar topics

6
by: RotterdamStudents | last post by:
Hello group, the script on this page i use to show the standings in a league. It is shown in a table on my webpage. But I don't know how to number the rows so that the first row is number 1 the...
3
by: Scott Hatton | last post by:
I have a table like this
2
by: z | last post by:
Hi, i just wanted to know how i can resize a table using javascript but in this special manner: I have two tables, one at the top of the page and the other below that one. The problem is that in...
1
by: MB | last post by:
Hi! I am trying to make a dynamic GroupBox that will contain a variable number of child controls of a single type, e.g. RadioButtons or CheckBoxes. I want to read the neccesarry information...
2
by: Vaughn | last post by:
Where can I get information on automatic resizing of controls when the form changes size (eg. if I dynamically increase the size of my form, the listview inside should automatically increase in...
0
by: kvinsi | last post by:
I would like grid stops with "right" resizing when mouse (spliter) come very close to the next column (sa same as it happens when you size "on the left"
5
by: Pete Davis | last post by:
First of all, I'm not real experienced with HTML or ASP.NET. I'm doing my first ASP.NET app. I'm working in VS.NET, and I'm laying out my controls in HTML tables. It seems that every once in a...
5
by: Daniel Wetzler | last post by:
Hi Sqlserver experts, I use the SQL Server enterprise manager of MSSQL 2000 regularly. I'm often annoyed by the automatic blanking of the table views. If this happens then mostly with the hint...
1
by: ajax.sam | last post by:
hi all, i got 2 questions! i want to do these: 1. select @col1 from some_table where <some_conditions>; I can pass parameters by using Parameters.Add for <some_conditionsbut not for the @col1....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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
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,...
0
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...

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.