Hey,
I'm trying to create a simple query to insert new rows to a table, which contain GUID (stored as string) in the first column.
In SQL it look like this:
INSERT INTO TARGET_TABLE (REC_ID, COL1, COL2)
SELECT NEWID(), COL_A, COL_B FROM SOURCE_TABLE
I want try to create an equivalent query to progress data base.
I assume that I need to use the function GUID(GENERATE-UUID) instead of NEWID(). But I did not succeeded.
Any suggestions?
Regards,
Moshe.
AFAIK, the client need to generate the GUID and pass the value to the INSERT statement rather than using a NEWID() function.
I don't want to create a huge sql statement.
I won't to run one simple SQL. the statement NEWID does not work on progress sql.
Someone?
I don't really understand what you want and what you won't do.
But, please check the SQL92 reference available at http://www.psdn.com/library/servlet/KbServlet/download/1915-102-5692/dmsrf-05-23-07.pdffor the list of available statements/functions. NEWID is available on MS-SQL server, but not for the OpenEdge database.
You might try to add a trigger. Look at the CREATE TRIGGER statement.
Mike
GENERATE-UUID is a 4GL function, you can't use that in SQL! The 4GL is a programming language which has it's own database access API. In parallel there is SQL-support with another feature set. You probably have to define a SQL-column as byte-array and when you define the SQL-statement you have to generate the GUID-value elsewhere and pass it as a byte array. The SQL-engine has no GUID-generator.
Be carefull: some databases might have performance issues when using real GUID's, because of the distribution of the GUID-values. That's why some databases provide a special GUID-function, which better fits indexing requirements...