RE: SQL - renaming a field

2019-07-26 Thread Chip Scheide via 4D_Tech
Good point -
I already simply forgot about trying to rename.

In concept it would not be an issue as I was only going to rename a 
field named 'Unused'
But there were other considerations to renaming that occurred to me 
after I posted.

in sql - if rename works, I do not see a way to redefine the column 
from say text to longint.
I did not try changing the column definition
unused as real  vs  existing data type of text

anyway - that part of the idea is dead.

Thanks!

Chip

On Fri, 26 Jul 2019 13:56:58 -0500, Stephen J. Orth wrote:
> Chip,
> 
> That kind of sucks because doesn't a "drop" destroy data?
> 
> Steve
> 
> -Original Message-
> From: 4D_Tech <4d_tech-boun...@lists.4d.com> On Behalf Of Chip 
> Scheide via 4D_Tech
> Sent: Friday, July 26, 2019 1:46 PM
> To: Tom Benedict 
> Cc: Chip Scheide <4d_o...@pghrepository.org>; 4D iNug Technical 
> <4d_tech@lists.4d.com>
> Subject: Re: SQL - renaming a field
> 
> OK
> 
> Thanks both
> 
> I guess rename is only possible as Drop + Add
> 
> Chip
> 
> 
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SQL - renaming a field

2019-07-26 Thread Narinder Chandi via 4D_Tech
Yup.

Actually, many flavours of SQL support table renaming or table duplication with 
additional keywords on ALTER TABLE since, at least in SQL92 AFAIK it wasn't 
supported as part of the DDL.

For example, the last time I used MySQL with the Sequel Pro GUI tool, It has a 
table duplication menu option which gives you the option to rename a table and 
also copies the data for you. This menu option is possible is because in MySQL 
the ALTER TABLE command supports the LIKE keyword, thus allowing you to do 
something like:
CREATE TABLE newTable LIKE oldTable; 
INSERT newTable SELECT * FROM oldTable;

Regards,
 
Narinder Chandi,
ToolBox Systems Ltd.
-- 

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List 
<4d_tech@lists.4d.com>
Organization: The Aquila Group, Inc.
Reply-To: , 4D Tech Mailing List 
<4d_tech@lists.4d.com>
Date: Friday, 26 July 2019 at 19:56
To: 4D Tech Mailing List <4d_tech@lists.4d.com>, 'Tom Benedict' 

Cc: "Stephen J. Orth" 
Subject: RE: SQL - renaming a field

Chip,

That kind of sucks because doesn't a "drop" destroy data?

Steve

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> On Behalf Of Chip Scheide via 
4D_Tech
Sent: Friday, July 26, 2019 1:46 PM
To: Tom Benedict 
Cc: Chip Scheide <4d_o...@pghrepository.org>; 4D iNug Technical 
<4d_tech@lists.4d.com>
Subject: Re: SQL - renaming a field

OK

Thanks both

I guess rename is only possible as Drop + Add

Chip

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: SQL - renaming a field

2019-07-26 Thread Stephen J. Orth via 4D_Tech
Chip,

That kind of sucks because doesn't a "drop" destroy data?

Steve

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> On Behalf Of Chip Scheide via 
4D_Tech
Sent: Friday, July 26, 2019 1:46 PM
To: Tom Benedict 
Cc: Chip Scheide <4d_o...@pghrepository.org>; 4D iNug Technical 
<4d_tech@lists.4d.com>
Subject: Re: SQL - renaming a field

OK

Thanks both

I guess rename is only possible as Drop + Add

Chip

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SQL - renaming a field

2019-07-26 Thread Chip Scheide via 4D_Tech
OK

Thanks both

I guess rename is only possible as Drop + Add

Chip

On Fri, 26 Jul 2019 11:42:49 -0700, Tom Benedict wrote:
> Maybe 4D’s SQL implementation doesn’t support the RENAME keyword?
> 
> I don’t see it in the docs.. 
> https://doc.4d.com/4Dv16/4D/16/ALTER-TABLE.300-3201314.en.html 
> 
> 
> Tom Benedict
> 
>> On Jul 26, 2019, at 11:30, Chip Scheide via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I'm trying to use SQL to rename an existing field
>> $Sql:="Alter table ["+$Table_Name+"] Rename "+"Unused"+" to 
>> "+$Field_Name+";"
>> 
>> When executed I get a parsing error at 'Rename'.
>> 
>> can someone better versed either correct my above syntax, or point out 
>> a way to rename an existing field using SQL, -- preferably without 
>> dropping and then adding.
>> 
>> Thanks
>> Chip
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SQL - renaming a field

2019-07-26 Thread Narinder Chandi via 4D_Tech
Chip,

My initial observations are:
* I think [ ] around the table name are not required (that's not part of the 
SQL standard)
* it would seem that 4D's implementation of Alter table doesn't support "rename"

Regards,
 
Narinder Chandi,
ToolBox Systems Ltd.
-- 

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List 
<4d_tech@lists.4d.com>
Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Date: Friday, 26 July 2019 at 19:30
To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Cc: Chip Scheide <4d_o...@pghrepository.org>
Subject: SQL - renaming a field

I'm trying to use SQL to rename an existing field
$Sql:="Alter table ["+$Table_Name+"] Rename "+"Unused"+" to 
"+$Field_Name+";"

When executed I get a parsing error at 'Rename'.

can someone better versed either correct my above syntax, or point out 
a way to rename an existing field using SQL, -- preferably without 
dropping and then adding.

Thanks
Chip

---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: SQL - renaming a field

2019-07-26 Thread Tom Benedict via 4D_Tech
Maybe 4D’s SQL implementation doesn’t support the RENAME keyword?

I don’t see it in the docs.. 
https://doc.4d.com/4Dv16/4D/16/ALTER-TABLE.300-3201314.en.html 


Tom Benedict

> On Jul 26, 2019, at 11:30, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I'm trying to use SQL to rename an existing field
> $Sql:="Alter table ["+$Table_Name+"] Rename "+"Unused"+" to 
> "+$Field_Name+";"
> 
> When executed I get a parsing error at 'Rename'.
> 
> can someone better versed either correct my above syntax, or point out 
> a way to rename an existing field using SQL, -- preferably without 
> dropping and then adding.
> 
> Thanks
> Chip
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

SQL - renaming a field

2019-07-26 Thread Chip Scheide via 4D_Tech
I'm trying to use SQL to rename an existing field
$Sql:="Alter table ["+$Table_Name+"] Rename "+"Unused"+" to 
"+$Field_Name+";"

When executed I get a parsing error at 'Rename'.

can someone better versed either correct my above syntax, or point out 
a way to rename an existing field using SQL, -- preferably without 
dropping and then adding.

Thanks
Chip

---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**