Board index » delphi » How do I add an new BLOB or MEMO column to remote table

How do I add an new BLOB or MEMO column to remote table

I have an application that allows the user to create their own fields for
customization.  What is the SQL syntax for adding a new column of type BLOB
or MEMO.  Hopefully this can be done at the lowest common method for all
ODBC compliant databases.

Currently the app is connected to MS-SQL 6.5, 7.0, ORACLE (most versions)
but can.

Also is there any source code out there for dropping a column from a MS-SQL
table?

--
Thanks in advance,
Craig

 

Re:How do I add an new BLOB or MEMO column to remote table


Quote
Craig Burke wrote:

> I have an application that allows the user to create their own fields for
> customization.  What is the SQL syntax for adding a new column of type BLOB
> or MEMO.  Hopefully this can be done at the lowest common method for all
> ODBC compliant databases.

> Currently the app is connected to MS-SQL 6.5, 7.0, ORACLE (most versions)
> but can.

> Also is there any source code out there for dropping a column from a MS-SQL
> table?

> --
> Thanks in advance,
> Craig

From SQL Books on line, Search1:
 "Alter Table"
 "Text and image data"
 "Datatypes"

ALTER TABLE [database.[owner].]table_name
[WITH NOCHECK]
[ADD
        {col_name column_properties [column_constraints]
        | [[,] table_constraint]}
                [, {next_col_name | next_table_constraint}]...]
|
[DROP [CONSTRAINT]
        constraint_name [, constraint_name2]...]

The syntax might be like:

{ for Blob }
ADD NewCol IMAGE

{ for Memo }
ADD NewCol TEXT

You could have a stored procedure that takes a @ColumnName, and
@DataType
as it's params.

HTH

Rkr

--

                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer                       .
. TVisualBasic:=class(None)               .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) home (dot) com    .
-------------------------------------------

Re:How do I add an new BLOB or MEMO column to remote table


In article <01be2f53$3e010d80$55a256d1@work-ccb>,
  "Craig Burke" <cbu...@lhsoftware.com> wrote:

Quote
> I have an application that allows the user to create their own fields for
> customization.  What is the SQL syntax for adding a new column of type BLOB
> or MEMO.  Hopefully this can be done at the lowest common method for all
> ODBC compliant databases.

> Currently the app is connected to MS-SQL 6.5, 7.0, ORACLE (most versions)
> but can.

> Also is there any source code out there for dropping a column from a MS-SQL
> table?

The SQL-92 syntax would be: alter table <tablename> add <new columnname>
<datatype> The only other thing that you should be determine then is the
datatype blob kind of datatypes are called different for most databases (long
raw or blob for oracle, image for SQLServer 6.5, memo for dBase, byte for
informix, long varchar for SQLBase, longbinary for MSAccess, note for
Btrieve,...). When using an odbc interface you can find this information via
the SQLGetTypeInfo function call with  longvarchar or longvarbinary as
parametervalues. This will return among others the name that is given to a
binary large object or character large object for that database.

Toffie.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Re:How do I add an new BLOB or MEMO column to remote table


Reid Roman escreveu na mensagem <3683B1E5.C5047...@home.com>...

Quote
>Craig Burke wrote:
>> Also is there any source code out there for dropping a column from a
MS-SQL
>> table?

You may do that only in MSSQL 7. In 6.5 you have to recreate the table.
I think it's something like:

ALTER TABLE TableName
  DROP columnName

Other Threads