Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Stored Procedure usage - cannot see 'sysname' datatype

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I have an application written in Delphi and I have an issue when I try and make use of a TStoredProc component.
I set up a TDatabase component (connected to a SQL Server database - either 7.0 or 2000) and connect up the TStoredProc component with 'StoredProcName' = 'sp_tables'.
This should give a result set with fields TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, TABLE_TYPE and REMARKS.
However when I hook up a TDataSource and make it visible I only get the two fields TABLE_TYPE and REMARKS (the other three are not to be found). The same thing happens with trying to define a list of fields against the TStoredProc component - I only have access to the last two fields.
I've tried not defining the fields and trying to read them using syntax like FieldByName('TABLE_NAME').AsString and FieldByName('TABLE_NAME').Value with errors indicating that these field does not exist - I'm assuming that Delphi / BDE cannot recognise these feilds.
This seems down to the fact that the first three fields are of type 'sysname' (SQL Server datatype) and the last two are 'varchar' - the 'varchar' being recognisible through Delphi / BDE. How can I make use of the Stored Procedure and achieve a read of all fields ?
In the past I've tried to make use of reading result sets from the system tables, i.e. :

SELECT UPPER (CAST([Name] AS CHAR)) TableName
FROM [sysobjects]
WHERE OBJECTPROPERTY(ID, N'IsUserTable') = 1
ORDER BY TableName

Originally the application was developed against SQL Server 7.0 and the above field had a length of 30 (SQL Server 7.0) - now running the same SQL code in a TQuery gives me an error - "Field 'TableName' is not of the expected type." - this being down to the fact that the above field is now having a length of 60. This was the original reason suggested to me that I should be making use of stored procedures - whereby I now experience the issue(s) above. Any help on these matters would be appreciated. :)

I don't know if its the version of the BDE I'm using ?
I'm working with version 5 - would a later version rectify the issues ?
Steve

Thanks in advance,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top