dynamic sql 
Author Message
 dynamic sql

Does sybase have anything like dynamic sql? I would like to perform the
following type of select:

select count(*)
from tbl_name

tbl_name is a string containing whatever table name that I want to do
the select on.

**********************************************************
* JOHN MCDOWELL  B-}    *  Principal Software Engineer   *

* (412) 268-6853        *  Carnegie Mellon University    *
* http://www.***.com/ ;    *
**********************************************************



Tue, 25 Apr 2000 03:00:00 GMT
 dynamic sql

John, Try this...
BEGIN
  declare tbl_name char(128);
  declare sql_stmt long varchar;

  set tbl_name = '"owner1"' + '"table1"';
  set sql_stmt = 'Select count(*) from ' + tbl_name;

  execute immediate sql_stmt;
END;
Paul Jensen



Quote:
> Does sybase have anything like dynamic sql? I would like to perform the
> following type of select:

> select count(*)
> from tbl_name

> tbl_name is a string containing whatever table name that I want to do
> the select on.

> **********************************************************
> * JOHN MCDOWELL  B-}    *  Principal Software Engineer   *

> * (412) 268-6853        *  Carnegie Mellon University    *
> * http://www.andrew.cmu.edu/user/mcdowell/john.html      *
> **********************************************************



Wed, 03 May 2000 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Dynamic SQL accessing dynamic temp tables

2. Dynamic Execute Statement vs. Passing Dynamic SQL

3. Dynamic order by without dynamic sql ?

4. DYNAMIC SQL MVS DB2 V6 DYNAMIC WHERE

5. PL/SQL:Efficiency of inline SQL vs use of Dynamic SQL Package

6. t-sql cursor with dynamic sql

7. SQL 2000 User Defined Function with Dynamic SQL

8. Dynamic SQL in SP Faster than Compiled SQL??!!!

9. Q : Dynamic SQL in sql server 6.5

10. SQL Server 6.5 Dynamic SQL inside Trigger to Access deleted Table

11. Dynamic SQL generation in T-SQL

12. SQL HELP...Dynamic SQL?


 
Powered by phpBB® Forum Software