Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is it possible to do dynamic SQL before ASE 12?

ASE Dynamic possible sql
0
Posted

Is it possible to do dynamic SQL before ASE 12?

0

——————————————————————————- Again, using CIS, it is possible to fake dynamic SQL. Obviously for this to work, CIS must be enabled. In addition, the local server must be added to sysservers as a remote server. There is a stored procedure, sp_remotesql, that takes as an arguments a remote server and a string, containing SQL. As before, adding SELF as the ‘dummy’ server name pointing to the local server as if it were a remote server, we can execute the following: sp_remotesql “SELF”,”select * from sysdatabases” Which will do just what you expect, running the query on the local machine. The stored proc will take 251 (according to its own documentation) arguments of char(255) or varchar(255) arguments, and concatenate them all together. So we can do the following: 1> declare @p1 varchar(255),@p2 varchar(255),@p3 varchar(255), @p4 varchar(255) 2> 3> select @p1 = “select”, 4> @p2 = ” name “, 5> @p3 = “from “, 6> @p4 = “sysdatabases” 7> 8> ex

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123