Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General Discussion » View Thread |
Messages 1 to 5 of 5 total |
Field exists inside a table. |
Tue, Dec 18 2012 9:43 AM | Permanent Link |
Abdulaziz Al-Jasser | Hi,
I am trying to write a stored procedure and need to check if a field exists inside a table. Any idea how to do that? Regards, Abdulaziz Jasser |
Tue, Dec 18 2012 10:07 AM | Permanent Link |
Abdulaziz Al-Jasser | SOLVED
SELECT "Name" FROM Information.TableColumns WHERE TableName = 'TB_Users' Regards, Abdulaziz Jasser |
Tue, Dec 18 2012 10:07 AM | Permanent Link |
Raul Team Elevate | You need to query system information tables for this : TableColumns in
this case :http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=TableColumns_Table Raul On 12/18/2012 9:43 AM, Abdulaziz Jasser wrote: > I am trying to write a stored procedure and need to check if a field exists inside a table. Any idea how to do that? > > Regards, > Abdulaziz Jasser > |
Tue, Dec 18 2012 10:25 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Abdulaziz
>I am trying to write a stored procedure and need to check if a field exists inside a table. Any idea how to do that? Its fairly simple - this is from my app - testing for existence of a table so I know it works PREPARE InfoStmt FROM 'SELECT * FROM Information.Tables WHERE Name=?'; OPEN InfoCursor USING TableName; IF (ROWCOUNT(InfoCursor) > 0) THEN EXECUTE IMMEDIATE 'DROP TABLE "'+TableName+'"'; END IF; Alter it to DECLARE FieldExists BOOLEAN DEFAULT TRUE; PREPARE InfoStmt FROM 'SELECT * FROM Information.TableColumns WHERE Table = ? AND Name=?'; OPEN InfoCursor USING TableName, ColumnName; IF (ROWCOUNT(InfoCursor) > 0) THEN SET FieldExists = TRUE; END IF; should do the trick Roy Lambert [Team Elevate] |
Wed, Dec 19 2012 11:36 AM | Permanent Link |
Abdulaziz Al-Jasser | Raul,
Roy, Many thanks. Regards, Abdulaziz Jasser |
This web page was last updated on Monday, May 6, 2024 at 12:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |