dbTalk Databases Forums  

CAST in CREATE VIEW gives error #845

comp.databases.btrieve comp.databases.btrieve


Discuss CAST in CREATE VIEW gives error #845 in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tim Farrar
 
Posts: n/a

Default CAST in CREATE VIEW gives error #845 - 09-04-2004 , 08:34 AM






In Pervasive.SQL v7, I have not been able to create a VIEW that
includes a CAST expression. I get Scalable SQL engine error #845.
E.g.,

CREATE VIEW
AS
SELECT
CAST( InvoiceDateString as DATE ) AS InvoiceDate
from InvoiceHdr;

The SELECT alone runs just fine in SQLScope. However, I think that the
CREATE VIEW sees the "as" of the CAST function as specifying a column
heading. The "AS" of the intended column heading would then appear to
the Scalable SQL engine to create more column headings than there are
columns in the SELECT statement, causing error #845:

The number of column headings must match the number of columns in the
view.

How do I accomplish the above CREATE VIEW in v7 without the error? We
are not in a position to move to v2000 at this point.

Will appreciate any sincere help offered.

Tim Farrar

Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: CAST in CREATE VIEW gives error #845 - 09-07-2004 , 07:09 AM






Need to just use the right syntax. The CREATE VIEW statement needs a bit
more in the header:

CREATE VIEW MyTestView (InvoiceDate)
AS
SELECT
CAST( InvoiceDateString as DATE )
from InvoiceHdr;

This works just fine.

BTW, I would not worry about moving to Pervasive.SQL 2000 at this point,
since it is also no longer supported. Look at PSQLV8 instead...
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Pervasive.SQL Service & Support Classes ***
Chicago: August, 2004: See our web site for details!


Tim Farrar wrote:

Quote:
In Pervasive.SQL v7, I have not been able to create a VIEW that
includes a CAST expression. I get Scalable SQL engine error #845.
E.g.,

CREATE VIEW
AS
SELECT
CAST( InvoiceDateString as DATE ) AS InvoiceDate
from InvoiceHdr;

The SELECT alone runs just fine in SQLScope. However, I think that the
CREATE VIEW sees the "as" of the CAST function as specifying a column
heading. The "AS" of the intended column heading would then appear to
the Scalable SQL engine to create more column headings than there are
columns in the SELECT statement, causing error #845:

The number of column headings must match the number of columns in the
view.

How do I accomplish the above CREATE VIEW in v7 without the error? We
are not in a position to move to v2000 at this point.

Will appreciate any sincere help offered.

Tim Farrar


Reply With Quote
  #3  
Old   
Tim Farrar
 
Posts: n/a

Default Re: CAST in CREATE VIEW gives error #845 - 09-09-2004 , 10:56 AM



Thank you, Bill! I got CREATE VIEW to work using your suggestion. My
mind must have passed over the "column names" part of the CREATE VIEW
statement in documentation, probably because it is not like MS SQL or
Oracle style of CREATE VIEW.

Tim Farrar


Bill Bach <bbach (AT) cncdsl (DOT) com> wrote

Quote:
Need to just use the right syntax. The CREATE VIEW statement needs a bit
more in the header:

CREATE VIEW MyTestView (InvoiceDate)
AS
SELECT
CAST( InvoiceDateString as DATE )
from InvoiceHdr;

This works just fine.

BTW, I would not worry about moving to Pervasive.SQL 2000 at this point,
since it is also no longer supported. Look at PSQLV8 instead...
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Pervasive.SQL Service & Support Classes ***
Chicago: August, 2004: See our web site for details!


Tim Farrar wrote:

In Pervasive.SQL v7, I have not been able to create a VIEW that
includes a CAST expression. I get Scalable SQL engine error #845.
E.g.,

CREATE VIEW
AS
SELECT
CAST( InvoiceDateString as DATE ) AS InvoiceDate
from InvoiceHdr;

The SELECT alone runs just fine in SQLScope. However, I think that the
CREATE VIEW sees the "as" of the CAST function as specifying a column
heading. The "AS" of the intended column heading would then appear to
the Scalable SQL engine to create more column headings than there are
columns in the SELECT statement, causing error #845:

The number of column headings must match the number of columns in the
view.

How do I accomplish the above CREATE VIEW in v7 without the error? We
are not in a position to move to v2000 at this point.

Will appreciate any sincere help offered.

Tim Farrar

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.