473,805 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change properties of existing tables without dataloss?

I have a lot of tables that hold a lot of numeric fields.
The names of all of these tables start with ' tblRO'
Now it turns out that all of the numeric fields with type double
precision have the property 'schaal' (<- dutch, the one above
'precision' ) set to zero. This should be '10' .

Is there a way to change this through VBA? Using a loop or so?
TIA Henro

Mar 22 '07 #1
3 2472
Excus me , I made an error!

I would like to know whether it is possible to change all the numeric
fields in certain tables to 'Decimal' type using code?
The decimal type has properties 'Precision' and 'Scale' (the latter
is a translated word from dutch which was 'schaal'.

I have to do this in 7 databases, 3 tables each, 14 fields
each..........
So I prefer some code that I can insert in a database and then run to
change the field properties.

Suggestions?

Greetings, Henro

On 22 mrt, 17:40, "Henrootje" <Hen...@gmail.c omwrote:
I have a lot of tables that hold a lot of numeric fields.
The names of all of these tables start with ' tblRO'
Now it turns out that all of the numeric fields with type double
precision have the property 'schaal' (<- dutch, the one above
'precision' ) set to zero. This should be '10' .

Is there a way to change this through VBA? Using a loop or so?
TIA Henro

Mar 26 '07 #2
On Mar 26, 6:41 am, "Henrootje" <Hen...@gmail.c omwrote:
I would like to know whether it is possible to change all the numeric
fields in certain tables to 'Decimal' type using code?
Before making such a wholesale change, look here:

http://allenbrowne.com/bug-08.html

Mar 26 '07 #3
On Mar 26, 7:16 pm, "Gord" <g...@kingston. netwrote:
I would like to know whether it is possible to change all the numeric
fields in certain tables to 'Decimal' type using code?

Before making such a wholesale change, look here:

http://allenbrowne.com/bug-08.html
I think the debate has moved on since that article was written and we
now seeing people recommending the DECIMAL data type.

Out of interest, do you agree with everything the articles says? I've
posted numerous rebuttals of the article in this groups which you
could google for. If you are genuinely interested in this subject then
perhaps we can discuss it further here. I hope you are not just
repeating something you've heard without checking the facts for
yourself first.

FWIW I've inadvertently made a misstatement on this topic which I'd
like to take this opportunity to correct:

http://groups.google.com/group/micro...45b50947e9839f

[quote]
>From "ADO Provider Properties and Settings"
(http://msdn.microsoft.com/library/de...library/en-us/
dnac...

"NULL Collation Order: A Long value (read-only) that specifies where
Null values are collated (sorted). For the Microsoft Jet provider,
the
value is always 4, which indicates that null values are sorted at the
low end of the list."

If there was a sort order bug with *any* Jet data type where the NULL
collation order was violated, it would be far more significant that
the
one under discussion that affects only negative DECIMAL values. Such
a
bug, should one exist, would almost certainly warrant a MSDN bug
article in itself. However, there is no such article and there is no
evidence I know of to suggest the NULL collation order is violated
under [any] circumstances.

[Unquote]

Actually, I think there is a problem where Jet NULL collation gets
violated. Consider that the essence of the DECIMAL sort order bug is
that the correctly-sorted set of negative values appear in the wrong
position of the resultset i.e. at the high end rather than between the
set of zeros and the set of NULLs at the low end. For example:

SELECT BadSort.dec_dat a
FROM
(
SELECT 3000000020 AS dec_data FROM DropMe
UNION ALL
SELECT NULL FROM DropMe
UNION ALL
SELECT -3000000010 FROM DropMe
UNION ALL
SELECT 0 FROM DropMe
UNION ALL
SELECT 3000000005 FROM DropMe
UNION ALL
SELECT -3000000005 FROM DropMe
UNION ALL
SELECT 0 FROM DropMe
UNION ALL
SELECT 3000000010 FROM DropMe
UNION ALL
SELECT NULL FROM DropMe
UNION ALL
SELECT -3000000020 FROM DropMe
) AS BadSort
ORDER BY BadSort.dec_dat a DESC;

So the trick would appear to be to force the set of zeros and positive
numbers to appear first and I've seen this posted as a suggested
solution:

ORDER BY BadSort.dec_dat a >= 0, BadSort.dec_dat a DESC;

However, this causes the NULL values to appear at the high end of the
resultset! The same problem is also exhibited by data types other than
DECIMAL.

So Jet's NULL collation has been violated and it does not seem to have
been big news. Guess I was wrong about that, then :(

I suspect the behaviour is due to known issues with the Jet's YESNO
data type which doesn't fit well with SQL's three-value logic (Jet
would appear to treat an UNKNOWN logical result differently than a
NULL value). The problem can be corrected, of course, in the ORDER BY
clause by removing the possibility of an UNKNOWN result by explicitly
handling NULL e.g.

ORDER BY BadSort.dec_dat a >= 0 AND BadSort.dec_dat a IS NOT NULL,
BadSort.dec_dat a DESC;

I suspect, though, that such an expression in the ORDER BY clause
would not perform well. My feeling is that the most *efficient* way to
sort would be to cast as DOUBLE, assuming that limiting scale to 15
significant figures is acceptable e.g.

ORDER BY CDBL(BadSort.de c_data DESC;

Interestingly, Allen condemns this as "very inefficient, requiring
conversion at every row" but I don't think that is correct: Jet has a
very efficient means of promoting a column of data to a higher type,
including promoting DECIMAL to DOUBLE.

All that said, I rarely if ever need to sort a resultset into an
explicit order in SQL (being a set-based language; sets have no
inherent order) and sorting in the middleware (e.g. recordset.Sort)
sidesteps the engine's problem with sorting.

PS I would also like to point out that Allen has said Access 2007 "is
too buggy for serious use" (http://allenbrowne.com/Access2007.html) so
I trust you will remind people of that at every mention of anything
Access 2007 related ;-)

Jamie.

--

Mar 27 '07 #4

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

Similar topics

5
50678
by: Robert Stearns | last post by:
Either I missed something, or ALTER TABLE does not have this capability. Is there any way of doing it except DROPping all constraints which mention this table, EXPORTing the data, DROPping the table, reCREATEing the table without the 'NOT NULL property, reCREATEing the INDEXes, reloading the data, redefining all of DROPped constraints reCREATE the view which were marked inactive by the above.
1
2418
by: Richard Holliingsworth | last post by:
Hello: The group has new 'standards' for online forms and I need to change the 'style' of my existing forms (A2002). Can I do this? I can't find a way using the GUI or the properties. Thanks, Richard H
13
6126
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which during production. Usually, this only wraps code used to control quitting the whole app versus just shutting a form, but it can also control many other things. However, as part of the build before delivering an update, I have to remember to...
3
2577
by: sparks | last post by:
I was copying fields from one table to another. IF the var name starts with milk I change it to egg and create it in the destination table. It works fine but I want to copy the description as well. Short version :) For Each fld In tdf.Fields pos = InStr(fld.Name, "milk") If pos > 0 Then
2
7754
by: Dennis Ruppert | last post by:
I created a routine to read and edit the description properties of tables, (the one you see in the database window). It works just fine. This is the basic code behind it, I substituted all my editing/updating code with the debug.print to keep it simple. Function EditTableDescriptions() On Error GoTo Err_EditTableDescriptions Dim db As DAO.Database Dim tbl As DAO.TableDef
18
18450
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
13
4186
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture' , data type='Number' ,Display Control='Combo Box', RowSource Type = 'Value List' and Row Source = ' 0;"chair";1;"Table";2;"Bed" ' Therefore, in data sheet view of table, if we select (1 : Table ) ,
5
2800
by: Dmitriy Lapko | last post by:
Hallo all Is it possible to change schema of table in DB2 v.8.2 without recreating and coping a table into a new schema? I need it for several purposes, one of them - refactoring of existing old database with more then 250 tables. I would like to split it to subsystems, but some of tables are quite large. And the size of tables prevents me from getting copy of production
1
1221
by: thesti | last post by:
hi, i'm going to develop a program using VB .NET. i've bound some textboxes to the same DataSource (DataSet1.Tables(0). and i enable the user to type the primaryKey of the data in the Table, so if the user has typed an existing PK in the table, the position of the CurrencyManager will be changed. in the 'KeyUp' event of the ID textBox, i implement this code Private Sub txtID_KeyUp(ByVal sender As Object, ByVal e As...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10366
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7646
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4323
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 we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.