Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

table as parameter in store procedure

3 posts in Windows NT Last posting was on 2000-04-13 23:25:41.0Z
Remy Roy Posted on 1999-12-31 18:30:23.0Z
Message-ID: <386CF63F.5FE2DC9C@vmd.desjardins.com>
Date: Fri, 31 Dec 1999 13:30:23 -0500
From: Remy Roy <remi.roy@vmd.desjardins.com>
X-Mailer: Mozilla 4.03 [fr] (WinNT; I)
MIME-Version: 1.0
Subject: table as parameter in store procedure
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 9
NNTP-Posting-Host: hive.vmd-info.com 198.73.251.30
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2751
Article PK: 1090181

Hi,

I would like to know how we can create a strore procedure using a table
name like
parameter that will be executed in a SQL command.

Example :

create procedure
@table_name varchar(30)
as
truncate table @table_name
return

We would to passed as parameter all tables that need to be truncate.


Thank you

Rémi


Bret Halford Posted on 1999-12-31 21:11:58.0Z
Message-ID: <386D1C1D.C4D974B4@sybase.com>
Date: Fri, 31 Dec 1999 14:11:58 -0700
From: Bret Halford <bret@sybase.com>
Organization: Sybase, Inc.
X-Mailer: Mozilla 4.5 [en]C-CCK-MCD (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: Remy Roy <remi.roy@vmd.desjardins.com>
Subject: Re: table as parameter in store procedure
References: <386CF63F.5FE2DC9C@vmd.desjardins.com>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 14
NNTP-Posting-Host: bret-pc.sybase.com 157.133.80.211
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2750
Article PK: 1090182

Simple solution: upgrade to ASE 12.0. You can then use the new "EXECUTE
IMMEDIATE" functionality to basicly do just that.

-bret

Remy Roy wrote:

> Hi,
>
> I would like to know how we can create a strore procedure using a table
> name like
> parameter that will be executed in a SQL command.
>
> Example :
>
> create procedure
> @table_name varchar(30)
> as
> truncate table @table_name
> return
>
> We would to passed as parameter all tables that need to be truncate.
>
> Thank you
>
> Rémi


Andre Felipe Barrocas Moreira Posted on 2000-04-13 23:25:41.0Z
Message-ID: <38F65775.C1BFA9F9@ihcap.com.br>
Date: Thu, 13 Apr 2000 20:25:41 -0300
From: Andre Felipe Barrocas Moreira <support@ihcap.com.br>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: en,pdf
MIME-Version: 1.0
Subject: Re: table as parameter in store procedure
References: <386CF63F.5FE2DC9C@vmd.desjardins.com> <386D1C1D.C4D974B4@sybase.com>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 22
NNTP-Posting-Host: cs018.esquadro.com.br 200.214.4.58
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2323
Article PK: 1089752

Try to declare your server as a local server, using sp_addserver and then try
using sp_remotesql local,<your statement>

Unfornunately, DDL commands could not be used.
Marcelo Teixeira Affonso
Icatu Hartford Captalizacao - Rio de Janeiro - Brazil

Bret Halford wrote:

> Simple solution: upgrade to ASE 12.0. You can then use the new "EXECUTE
> IMMEDIATE" functionality to basicly do just that.
>
> -bret
>
> Remy Roy wrote:
>
> > Hi,
> >
> > I would like to know how we can create a strore procedure using a table
> > name like
> > parameter that will be executed in a SQL command.
> >
> > Example :
> >
> > create procedure
> > @table_name varchar(30)
> > as
> > truncate table @table_name
> > return
> >
> > We would to passed as parameter all tables that need to be truncate.
> >
> > Thank you
> >
> > Rémi