|
-
Feb 3rd, 2008, 06:35 AM
#1
Thread Starter
Frenzied Member
[2008] Two Questions, Deleting all the content in a column, and space used by column
I need to know two things, and would appreciate help with them...
Question 1: I want to delete all the values in my column 'testValue' and in my column ID.
Question 2: I will be storing large amounts of strings and integers (a lot), and I would like to know how to assess how much space in bytes (from bytes I can turn that into kilobytes, and megabytes), does anyone know that?
Thanks alot
-
Feb 3rd, 2008, 07:12 AM
#2
Re: [2008] Two Questions, Deleting all the content in a column, and space used by column
At column in what?
A ListView?
A DB table?
An Excel Spreadsheet?
??
-
Feb 3rd, 2008, 07:22 AM
#3
Hyperactive Member
Re: [2008] Two Questions, Deleting all the content in a column, and space used by column
A column of what? A datagridview, a database table?
Each character in a string takes two bytes; each data point of int32 (integer in the VB world) takes four bytes:
A = string.length * 2 bytes
B = int32 * no of data points * 4 bytes
(A + B) / 1024 = kilobytes
kilobytes / 1024 = megabytes
-
Feb 3rd, 2008, 04:39 PM
#4
Thread Starter
Frenzied Member
Re: [2008] Two Questions, Deleting all the content in a column, and space used by col
mehh! sorry, I wasn't thinking:P
I am referring to a database, a column in a database.
(And I want to use SQL to do this, using SqlCommand in VB)
Thanks
-
Feb 3rd, 2008, 05:40 PM
#5
Re: [2008] Two Questions, Deleting all the content in a column, and space used by column
Icy, have you read any SQL tutorisl or reference material? Have you read any ADO.NET tutorials or reference? It seems to me that the answer would be "no", given the flurry of SQL and ADO.NET related questions recently. Would doing so not be a good idea?
-
Feb 3rd, 2008, 08:28 PM
#6
Thread Starter
Frenzied Member
Re: [2008] Two Questions, Deleting all the content in a column, and space used by col
Actually I have, ADO.NET, only a little bit (what does this actually cover?)
And I have downloaded an entire SQL tutorial site to review (my computer's internet is broken, (I use my parents computer, when they are not working, which is not often!!)
Cheers
-
Feb 4th, 2008, 03:41 AM
#7
Hyperactive Member
Re: [2008] Two Questions, Deleting all the content in a column, and space used by column
update tablename
set testValue='' (Assumes testValue holds strings)
I'm not too happy with this idea of deleting your ID column! Having done so, how do you intend to address individual records? Anyhoo, the technique above should suffice, unless you have an identity column(!) and remember to update the ID column to a value of its data type; or else Null (assuming that you have allowed Null values in an ID column??!!)
-
Feb 4th, 2008, 05:10 AM
#8
Re: [2008] Two Questions, Deleting all the content in a column, and space used by column
alter table tablename drop columnname
Your mileage may vary, given that you didn't say what variant of SQL you're using.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|