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.

String arguments

7 posts in General Discussion Last posting was on 2003-11-04 16:55:28.0Z
Anders Peterson Posted on 2003-11-04 14:01:47.0Z
From: Anders Peterson <anders_peterson@optimatika.se>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: String arguments
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: h195n2fls35o276.telia.com
X-Original-NNTP-Posting-Host: h195n2fls35o276.telia.com
Message-ID: <3fa7b14b$1@forums-1-dub>
Date: 4 Nov 2003 06:01:47 -0800
X-Trace: forums-1-dub 1067954507 81.224.43.195 (4 Nov 2003 06:01:47 -0800)
X-Original-Trace: 4 Nov 2003 06:01:47 -0800, h195n2fls35o276.telia.com
Lines: 21
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2005
Article PK: 4236

Hi,

I'm using SQL Anywhere Studio 7, and would like to write a procedure
that would do this:

CREATE procedure DBA.backup_database(in @directory_path char)
on exception resume
begin
if(@directory_path is null) then set
@directory_path='C:\\Sybase\\Databases\\Backup'
end if;
backup database directory @directory_path transaction log truncate;
unload from table QGroup.QsdChange to @directory_path +
'\\QsdChange.txt';
...

The above code doesn't work! How can I change it to work? How can I pass
directory paths as variable arguments?

/Anders


"Bruce Hay" Posted on 2003-11-04 14:05:28.0Z
From: "Bruce Hay" <hay at sybase dot com>
Newsgroups: ianywhere.public.general
References: <3fa7b14b$1@forums-1-dub>
Subject: Re: String arguments
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Original-NNTP-Posting-Host: 172.31.142.57
Message-ID: <3fa7b354$1@forums-2-dub>
X-Original-Trace: 4 Nov 2003 06:10:28 -0800, 172.31.142.57
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 4 Nov 2003 05:57:17 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 4 Nov 2003 06:05:28 -0800
X-Trace: forums-1-dub 1067954728 10.22.108.75 (4 Nov 2003 06:05:28 -0800)
X-Original-Trace: 4 Nov 2003 06:05:28 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2006
Article PK: 4233

This will be supported in 9.0.1. Until then, you'll need to use EXECUTE
IMMEDIATE and double the backslashes as needed.

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer

"Anders Peterson" <anders_peterson@optimatika.se> wrote in message
news:3fa7b14b$1@forums-1-dub...
> Hi,
>
> I'm using SQL Anywhere Studio 7, and would like to write a procedure
> that would do this:
>
> CREATE procedure DBA.backup_database(in @directory_path char)
> on exception resume
> begin
> if(@directory_path is null) then set
> @directory_path='C:\\Sybase\\Databases\\Backup'
> end if;
> backup database directory @directory_path transaction log truncate;
> unload from table QGroup.QsdChange to @directory_path +
> '\\QsdChange.txt';
> ...
>
> The above code doesn't work! How can I change it to work? How can I pass
> directory paths as variable arguments?
>
> /Anders
>


Anders Peterson Posted on 2003-11-04 14:26:43.0Z
Message-ID: <3FA7B53B.3050505@optimatika.se>
From: Anders Peterson <anders_peterson@optimatika.se>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
To: Bruce Hay <hay@sybase.com>
Subject: Re: String arguments
References: <3fa7b14b$1@forums-1-dub> <3fa7b354$1@forums-2-dub>
In-Reply-To: <3fa7b354$1@forums-2-dub>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: h195n2fls35o276.telia.com
X-Original-NNTP-Posting-Host: h195n2fls35o276.telia.com
Date: 4 Nov 2003 06:26:43 -0800
X-Trace: forums-1-dub 1067956003 81.224.43.195 (4 Nov 2003 06:26:43 -0800)
X-Original-Trace: 4 Nov 2003 06:26:43 -0800, h195n2fls35o276.telia.com
Lines: 46
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2007
Article PK: 4235

Thank you. That was a quick answer. So I need to construct a string of
the entire command including the path

backup database directory 'C:\\Sybase\\Databases\\Backup' transaction
log truncate

How do I write a string containing the ' character? Writing \' doesn't work?

/Anders

Bruce Hay wrote:

> This will be supported in 9.0.1. Until then, you'll need to use EXECUTE
> IMMEDIATE and double the backslashes as needed.
>
> Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
> Developer Community at http://www.ianywhere.com/developer
>
> "Anders Peterson" <anders_peterson@optimatika.se> wrote in message
> news:3fa7b14b$1@forums-1-dub...
>
>>Hi,
>>
>>I'm using SQL Anywhere Studio 7, and would like to write a procedure
>>that would do this:
>>
>>CREATE procedure DBA.backup_database(in @directory_path char)
>>on exception resume
>>begin
>> if(@directory_path is null) then set
>>@directory_path='C:\\Sybase\\Databases\\Backup'
>> end if;
>> backup database directory @directory_path transaction log truncate;
>> unload from table QGroup.QsdChange to @directory_path +
>>'\\QsdChange.txt';
>>...
>>
>>The above code doesn't work! How can I change it to work? How can I pass
>>directory paths as variable arguments?
>>
>>/Anders
>>
>
>
>


Greg Fenton Posted on 2003-11-04 15:29:18.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4; MultiZilla v1.4.0.4A) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: String arguments
References: <3fa7b14b$1@forums-1-dub> <3fa7b354$1@forums-2-dub> <3FA7B53B.3050505@optimatika.se>
In-Reply-To: <3FA7B53B.3050505@optimatika.se>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <3fa7c6fb@forums-2-dub>
X-Original-Trace: 4 Nov 2003 07:34:19 -0800, gfenton-xp.sybase.com
Lines: 20
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 4 Nov 2003 07:21:07 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 4 Nov 2003 07:29:18 -0800
X-Trace: forums-1-dub 1067959758 10.22.108.75 (4 Nov 2003 07:29:18 -0800)
X-Original-Trace: 4 Nov 2003 07:29:18 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2011
Article PK: 4230


Anders Peterson wrote:
>
> How do I write a string containing the ' character? Writing \' doesn't
> work?
>

You would use two single quotes:

EXECUTE IMMEDIATE 'backup database directory ''c:\\mydir'' [...]'

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


"Bruce Hay" Posted on 2003-11-04 15:22:25.0Z
From: "Bruce Hay" <hay at sybase dot com>
Newsgroups: ianywhere.public.general
References: <3fa7b14b$1@forums-1-dub> <3fa7b354$1@forums-2-dub> <3FA7B53B.3050505@optimatika.se>
Subject: Re: String arguments
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 172.31.142.57
X-Original-NNTP-Posting-Host: 172.31.142.57
Message-ID: <3fa7c431$2@forums-1-dub>
Date: 4 Nov 2003 07:22:25 -0800
X-Trace: forums-1-dub 1067959345 172.31.142.57 (4 Nov 2003 07:22:25 -0800)
X-Original-Trace: 4 Nov 2003 07:22:25 -0800, 172.31.142.57
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2009
Article PK: 4237

Two consecutive quotes inside a string can be used to represent a single
quote.

"Anders Peterson" <anders_peterson@optimatika.se> wrote in message
news:3FA7B53B.3050505@optimatika.se...
> Thank you. That was a quick answer. So I need to construct a string of
> the entire command including the path
>
> backup database directory 'C:\\Sybase\\Databases\\Backup' transaction
> log truncate
>
> How do I write a string containing the ' character? Writing \' doesn't
work?
>
> /Anders
>
> Bruce Hay wrote:
>
> > This will be supported in 9.0.1. Until then, you'll need to use EXECUTE
> > IMMEDIATE and double the backslashes as needed.
> >
> > Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
> > Developer Community at http://www.ianywhere.com/developer
> >
> > "Anders Peterson" <anders_peterson@optimatika.se> wrote in message
> > news:3fa7b14b$1@forums-1-dub...
> >
> >>Hi,
> >>
> >>I'm using SQL Anywhere Studio 7, and would like to write a procedure
> >>that would do this:
> >>
> >>CREATE procedure DBA.backup_database(in @directory_path char)
> >>on exception resume
> >>begin
> >> if(@directory_path is null) then set
> >>@directory_path='C:\\Sybase\\Databases\\Backup'
> >> end if;
> >> backup database directory @directory_path transaction log truncate;
> >> unload from table QGroup.QsdChange to @directory_path +
> >>'\\QsdChange.txt';
> >>...
> >>
> >>The above code doesn't work! How can I change it to work? How can I pass
> >>directory paths as variable arguments?
> >>
> >>/Anders
> >>
> >
> >
> >
>


Anders Peterson Posted on 2003-11-04 16:01:25.0Z
From: Anders Peterson <anders_peterson@optimatika.se>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: String arguments
References: <3fa7b14b$1@forums-1-dub> <3fa7b354$1@forums-2-dub> <3FA7B53B.3050505@optimatika.se>
In-Reply-To: <3FA7B53B.3050505@optimatika.se>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: h195n2fls35o276.telia.com
Message-ID: <3fa7ce80@forums-2-dub>
X-Original-Trace: 4 Nov 2003 08:06:24 -0800, h195n2fls35o276.telia.com
Lines: 78
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 4 Nov 2003 07:53:12 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 4 Nov 2003 08:01:25 -0800
X-Trace: forums-1-dub 1067961685 10.22.108.75 (4 Nov 2003 08:01:25 -0800)
X-Original-Trace: 4 Nov 2003 08:01:25 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2012
Article PK: 17406

Thanks again, and sorry to have bothered you with such a trivial
questsion. I'm not done yet...

This procedure works the way I want it to ():

ALTER procedure DBA.backup_database(in @directory_path char)
on exception resume
begin
execute immediate 'backup database directory ''' ||
'C:\\Sybase\\Databases\\Backup' || ''' transaction log truncate'
end

But calling this:

ALTER procedure DBA.backup_database(in @directory_path char)
on exception resume
begin
execute immediate 'backup database directory ''' || @directory_path
|| ''' transaction log truncate'
end

with an argument of 'C:\\Sybase\\Databases\\Backup' saves the backup in
C:\WINDOWS\system32\C.

Where did C:\WINDOWS\system32\ come from? What happened to
:\\Sybase\\Databases\\Backup?

/Anders

Anders Peterson wrote:
> Thank you. That was a quick answer. So I need to construct a string of
> the entire command including the path
>
> backup database directory 'C:\\Sybase\\Databases\\Backup' transaction
> log truncate
>
> How do I write a string containing the ' character? Writing \' doesn't
> work?
>
> /Anders
>
> Bruce Hay wrote:
>
>> This will be supported in 9.0.1. Until then, you'll need to use EXECUTE
>> IMMEDIATE and double the backslashes as needed.
>>
>> Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
>> Developer Community at http://www.ianywhere.com/developer
>>
>> "Anders Peterson" <anders_peterson@optimatika.se> wrote in message
>> news:3fa7b14b$1@forums-1-dub...
>>
>>> Hi,
>>>
>>> I'm using SQL Anywhere Studio 7, and would like to write a procedure
>>> that would do this:
>>>
>>> CREATE procedure DBA.backup_database(in @directory_path char)
>>> on exception resume
>>> begin
>>> if(@directory_path is null) then set
>>> @directory_path='C:\\Sybase\\Databases\\Backup'
>>> end if;
>>> backup database directory @directory_path transaction log truncate;
>>> unload from table QGroup.QsdChange to @directory_path +
>>> '\\QsdChange.txt';
>>> ...
>>>
>>> The above code doesn't work! How can I change it to work? How can I pass
>>> directory paths as variable arguments?
>>>
>>> /Anders
>>>
>>
>>
>>
>


"Bruce Hay" Posted on 2003-11-04 16:55:28.0Z
From: "Bruce Hay" <hay at sybase dot com>
Newsgroups: ianywhere.public.general
References: <3fa7b14b$1@forums-1-dub> <3fa7b354$1@forums-2-dub> <3FA7B53B.3050505@optimatika.se> <3fa7ce80@forums-2-dub>
Subject: Re: String arguments
Lines: 95
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Original-NNTP-Posting-Host: 172.31.142.57
Message-ID: <3fa7db2c@forums-2-dub>
X-Original-Trace: 4 Nov 2003 09:00:28 -0800, 172.31.142.57
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 4 Nov 2003 08:47:17 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 4 Nov 2003 08:55:28 -0800
X-Trace: forums-1-dub 1067964928 10.22.108.75 (4 Nov 2003 08:55:28 -0800)
X-Original-Trace: 4 Nov 2003 08:55:28 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2014
Article PK: 17413

The parameter is declare as CHAR, which really means CHAR(1). Specify a size
or use LONG VARCHAR.

If the path for a BACKUP statement is a relative path (i.e. no drive or
leading \), it will be relative to the directory in which the server was
started. Looks like the current directory for your server was
'c:\windows\system32'.

Whitepapers, TechDocs, bug fixes are all available through the iAnywhere
Developer Community at http://www.ianywhere.com/developer

"Anders Peterson" <anders_peterson@optimatika.se> wrote in message
news:3fa7ce80@forums-2-dub...
> Thanks again, and sorry to have bothered you with such a trivial
> questsion. I'm not done yet...
>
> This procedure works the way I want it to ():
>
> ALTER procedure DBA.backup_database(in @directory_path char)
> on exception resume
> begin
> execute immediate 'backup database directory ''' ||
> 'C:\\Sybase\\Databases\\Backup' || ''' transaction log truncate'
> end
>
> But calling this:
>
> ALTER procedure DBA.backup_database(in @directory_path char)
> on exception resume
> begin
> execute immediate 'backup database directory ''' || @directory_path
> || ''' transaction log truncate'
> end
>
> with an argument of 'C:\\Sybase\\Databases\\Backup' saves the backup in
> C:\WINDOWS\system32\C.
>
> Where did C:\WINDOWS\system32\ come from? What happened to
> :\\Sybase\\Databases\\Backup?
>
> /Anders
>
> Anders Peterson wrote:
> > Thank you. That was a quick answer. So I need to construct a string of
> > the entire command including the path
> >
> > backup database directory 'C:\\Sybase\\Databases\\Backup' transaction
> > log truncate
> >
> > How do I write a string containing the ' character? Writing \' doesn't
> > work?
> >
> > /Anders
> >
> > Bruce Hay wrote:
> >
> >> This will be supported in 9.0.1. Until then, you'll need to use EXECUTE
> >> IMMEDIATE and double the backslashes as needed.
> >>
> >> Whitepapers, TechDocs, bug fixes are all available through the
iAnywhere
> >> Developer Community at http://www.ianywhere.com/developer
> >>
> >> "Anders Peterson" <anders_peterson@optimatika.se> wrote in message
> >> news:3fa7b14b$1@forums-1-dub...
> >>
> >>> Hi,
> >>>
> >>> I'm using SQL Anywhere Studio 7, and would like to write a procedure
> >>> that would do this:
> >>>
> >>> CREATE procedure DBA.backup_database(in @directory_path char)
> >>> on exception resume
> >>> begin
> >>> if(@directory_path is null) then set
> >>> @directory_path='C:\\Sybase\\Databases\\Backup'
> >>> end if;
> >>> backup database directory @directory_path transaction log truncate;
> >>> unload from table QGroup.QsdChange to @directory_path +
> >>> '\\QsdChange.txt';
> >>> ...
> >>>
> >>> The above code doesn't work! How can I change it to work? How can I
pass
> >>> directory paths as variable arguments?
> >>>
> >>> /Anders
> >>>
> >>
> >>
> >>
> >
>