Author Topic: Globally change data type  (Read 8449 times)

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Globally change data type
« on: January 08, 2014, 07:53:47 am »
Hi

I want to know if there is any way to in EA to globally change the data type?

for e.g I have 30 columns throughout my data model that were initially defined as LONG VARCHAR...now  i want to change from LONG VARCHAR to VARCHAR...so instead of going through all columns one by one to change it any way that i can change it in one place so that the change gets reflected in all 30 columns

Thanks
KN

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #1 on: January 08, 2014, 08:34:53 am »
You can write a script to replace Element.Attribute().Type for the respective elements of you can write a SQL to change it in t_attribute.type.

I'm a bit uncertain about columns, but it should be equivalent to class attributes.

q.


K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #2 on: January 10, 2014, 03:38:08 am »
Thanx qwerty...but i m not good with scripting..

is there any other way?

actually i tried exporting that model in xml file and changing the datatype there and then importing back ...but it didnt work.

Thanks KN

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #3 on: January 10, 2014, 07:54:18 am »
The only other way would be to run a SQL in a DB client like
Code: [Select]
UPDATE t_attribute SET type = 'new type' WHERE type = 'old type'
However, this should also be possible with XML editing. What did not work? The datatype must be legal (part of the existing list for the chosen DB).

q.

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #4 on: January 16, 2014, 02:31:16 am »
Thnks qwerty...yes it is legal...but i am also changing it to one of its legal type only...

let me try this query...i typed this query into the find in Project --->SQL tab but nothing happens...

even i tried to list all items in t_attribute...nothing comes up..

Thanks
KN

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #5 on: January 16, 2014, 02:46:20 am »
You simply can't use EA's query window to do that. It's restricted to SELECT only. Either  use a native client or modify one of the pre-defined VB scripts so it contains Repository.Execute ("UPDATE...") as single statement. This way you can execute non-SELECT statements. I'd prefer the native client. Try TOAD. If you are using EAP you probably need MS Access.

q.

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #6 on: January 16, 2014, 02:49:19 am »
ok..then how to open .eap file in MS Access?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #7 on: January 16, 2014, 04:10:55 am »
Probably the easiest way is to rename it to .mdb (hope my memory is correct with the suffix) and then you should be ready to go.

q.

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #8 on: January 16, 2014, 04:12:44 am »
you mean .accdb?

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #9 on: January 16, 2014, 04:48:44 am »
@qwerty: I tried changing the suffix but it gives an error like this

"Cannot open database created with previous version of your application."

I am trying to open version 10 eap file in MS Access 2013.

Thanks
KN

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8063
  • Karma: +118/-20
    • View Profile
Re: Globally change data type
« Reply #10 on: January 16, 2014, 10:18:31 am »
That's right. Eap files are from either JET 3.5 or JET 4. The simple reason for that is we can distribute the required files to open them. That's not true for accdb files. However, the corporate version does support connecting to accdb files.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #11 on: January 17, 2014, 12:25:11 am »
Quote
you mean .accdb?
I meant mdb. That was the suffix as long as I knew it. Honestly I do not like any of Mickeysofts products. If you have an old MS Access version you'd be able to go with that. Obviously the new ones are incompatible (though you still can use MS DOS?!). I have no idea how to deal with accdb :(

q.

K N

  • EA User
  • **
  • Posts: 98
  • Karma: +0/-0
    • View Profile
Re: Globally change data type
« Reply #12 on: January 17, 2014, 12:32:19 am »
Thanks Simon & qwerty...

so i should try the following:
 - rename the .eap to .mdb
 - open that .mdb in Access 2007

Thanks
KN

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Globally change data type
« Reply #13 on: January 17, 2014, 02:35:43 am »
I guess that should work. At least I remember having done that some years ago. (Anyway I prefer to use the scripting way as you may guess  ;))

Good luck (and don't forget to backup)!

q.

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Globally change data type
« Reply #14 on: January 17, 2014, 02:47:39 pm »
Access should recognise the format regardless of the file suffix.
So, much easier to do a: File | Open - in Access.
In the File dialog set File Name: to *.eap .

Then it should list all the .eap files.
Selecting one will open - but with a prompt about being unsafe - ignore that and just open it.