Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

Topic-icon Solved How to provide dynamic SQL table name as metadata in sql operation

More
10 Oct 2017 14:43 #1 by nikita.barve
Hello ,

we generate daily backup of d_stockiest table with timestamp appended.
i wrote dynamic sql loop query for deleting all backup tables one by one except recent 5 backup tables.

but it gives bellow error :"Cannot drop the table 'd_stockist_hq_mapping_bkp_20171010173223', because it does not exist or you do not have permission".


because name of table to be deleted is dynamic so i cant drag that metadata on sql operation.

if i run these query on sql server it works n it gives below result



please suggest solution
Attachments:
More
10 Oct 2017 17:19 #2 by Thomas BLETON
Hi,
The error message mentions that the table might not exist or the user does not have permisssion to drop the table.
Can you check this last point ?

You can try adding the catalog.schema prefix to the table name too (sql server's query tool has a "current" database set, the stambia process might not have such thing, depending on how your metadata is configured).
For example : Drop table db01.schema01.d_stockist_...
More
14 Nov 2017 07:05 #3 by nikita.barve
Hi,

Thanks for your solution .
its working properly.


Thanks & Regards,
Nikita Barve