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.

equivalence Between Sybase and SQL-Server

5 posts in General Discussion Last posting was on 2005-10-20 13:53:04.0Z
Enan0 Posted on 2005-10-19 21:19:43.0Z
Sender: 745a.4356b672.1804289383@sybase.com
From: Enan0
Newsgroups: ianywhere.public.general
Subject: equivalence Between Sybase and SQL-Server
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4356b787.7468.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 19 Oct 2005 14:15:51 -0700, 10.22.241.42
Lines: 16
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 19 Oct 2005 14:15:52 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 19 Oct 2005 14:19:43 -0700
X-Trace: forums-1-dub 1129756783 10.22.108.75 (19 Oct 2005 14:19:43 -0700)
X-Original-Trace: 19 Oct 2005 14:19:43 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!forums-2-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4872
Article PK: 31464

Hi Im Trying check if not exist and espefic table, now I
konw how is in SQL-server:
"if not exists (select * from sysobjects where id =
object_id(N'[dbo].[RegMailMapp]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)"

In Sybase i Try:

"if not exists (select * from sysobjects where id =
object_id('[RegMailMapp]')) then"

But this dont work... Regards

PD: now Im Tring do the same with a TRigger

Regards


Greg Fenton Posted on 2005-10-20 13:28:31.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla Thunderbird 1.6.3.2f (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: equivalence Between Sybase and SQL-Server
References: <4356b787.7468.1681692777@sybase.com>
In-Reply-To: <4356b787.7468.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: gfenton-t30.sybase.com
X-Original-NNTP-Posting-Host: gfenton-t30.sybase.com
Message-ID: <43579b7f@forums-1-dub>
Date: 20 Oct 2005 06:28:31 -0700
X-Trace: forums-1-dub 1129814911 10.25.98.144 (20 Oct 2005 06:28:31 -0700)
X-Original-Trace: 20 Oct 2005 06:28:31 -0700, gfenton-t30.sybase.com
Lines: 31
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4875
Article PK: 8585


Enan0 wrote:
>
> In Sybase i Try:
>
> "if not exists (select * from sysobjects where id =
> object_id('[RegMailMapp]')) then"
>

Are you talking about Sybase ASE (enterprise) or iAnywhere/Sybase ASA
(anywhere)?

For the above, try:

IF NOT EXISTS (SELECT 1 FROM SYSTABLE where table_name =
'RegMailMapp' AND creator NOT IN ('dbo', 'sys')) THEN
MESSAGE 'It does not exist';
ELSE
MESSAGE 'It does exist!!';
END IF

BTW: please always post the version and build number of ASA that you are
using (e.g. use the command "dbeng9 -v" for ASA 9.x).

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


Breck Carter [TeamSybase] Posted on 2005-10-20 13:53:04.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: equivalence Between Sybase and SQL-Server
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <bn6fl1hgtkipa1euqvb97ho88kmot0hv3k@4ax.com>
References: <4356b787.7468.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 20 Oct 2005 06:53:04 -0700
X-Trace: forums-1-dub 1129816384 64.7.134.118 (20 Oct 2005 06:53:04 -0700)
X-Original-Trace: 20 Oct 2005 06:53:04 -0700, bcarter.sentex.ca
Lines: 53
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4876
Article PK: 17453

Try this...

IF NOT EXISTS ( SELECT *
FROM SYS.SYSTABLE
WHERE USER_NAME ( SYS.SYSTABLE.creator )
= CURRENT USER
AND SYS.SYSTABLE.table_name
= 'RegMailMapp' ) THEN

In SQL Anywhere it is *not* a good idea to use the user id "dbo" as
table owner. Permissions and privileges work differently in SQL
Anywhere, and there is no need to for the "database owner" thing that
is represented by "dbo" in Transact SQL... in fact, it really doesn't
exist: "dbo" is an actual user id in SQL Anywhere.

Here is a suggestion: Use DBA to create all the tables. Then do this:

GRANT GROUP TO DBA;
GRANT MEMBERSHIP IN GROUP DBA TO uuu; -- stops "not found" errors
GRANT SELECT ON ttt TO DBA; -- stops "permission denied" errors

Now the user "uuu" can do "SELECT * FROM RegMailMapp" without any
problems. Also note that "uuu" does not inherit the special "DBA"
privilege through group membership, so "uuu" still can't do a delete,
etc.

Breck

On 19 Oct 2005 14:19:43 -0700, Enan0 wrote:

>Hi Im Trying check if not exist and espefic table, now I
>konw how is in SQL-server:
> "if not exists (select * from sysobjects where id =
>object_id(N'[dbo].[RegMailMapp]') and OBJECTPROPERTY(id,
>N'IsUserTable') = 1)"
>
>In Sybase i Try:
>
>"if not exists (select * from sysobjects where id =
>object_id('[RegMailMapp]')) then"
>
>But this dont work... Regards
>
>PD: now Im Tring do the same with a TRigger
>
>Regards

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com


krisztian pinter Posted on 2005-10-20 07:29:50.0Z
Newsgroups: ianywhere.public.general
Subject: Re: equivalence Between Sybase and SQL-Server
References: <4356b787.7468.1681692777@sybase.com>
Message-ID: <opsyxobaorwwfehv@kar_wst_pint>
From: "krisztian pinter" <pinterkr@freemail.hu>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-2
MIME-Version: 1.0
Content-Transfer-Encoding: Quoted-Printable
User-Agent: Opera M2/7.54 (Win32, build 3869)
X-Original-NNTP-Posting-Host: b178.dummy.pool.eol.hu
X-Original-Trace: 20 Oct 2005 00:25:53 -0700, b178.dummy.pool.eol.hu
Lines: 7
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 20 Oct 2005 00:25:56 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 20 Oct 2005 00:29:50 -0700
X-Trace: forums-1-dub 1129793390 10.22.108.75 (20 Oct 2005 00:29:50 -0700)
X-Original-Trace: 20 Oct 2005 00:29:50 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!forums-2-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4873
Article PK: 31465


On 19 Oct 2005 14:15:51 -0700, <Enan0> wrote:

> "if not exists (select * from sysobjects where id =
> object_id('[RegMailMapp]')) then"

tried on ASA 8, and found that it does not support braces nor
double quotes.


David Fishburn Posted on 2005-10-20 13:25:23.0Z
Newsgroups: ianywhere.public.general
Subject: Re: equivalence Between Sybase and SQL-Server
From: David Fishburn <fishburn_spam@off.ianywhere.com>
References: <4356b787.7468.1681692777@sybase.com>
Organization: iAnywhere Solutions
Message-ID: <Xns96F55F212935Dfishburnsybasecom@127.0.0.1>
User-Agent: Xnews/06.08.25 Hamster/2.0.6.0
NNTP-Posting-Host: fishburn-t30.sybase.com
X-Original-NNTP-Posting-Host: fishburn-t30.sybase.com
Date: 20 Oct 2005 06:25:23 -0700
X-Trace: forums-1-dub 1129814723 10.25.98.140 (20 Oct 2005 06:25:23 -0700)
X-Original-Trace: 20 Oct 2005 06:25:23 -0700, fishburn-t30.sybase.com
Lines: 36
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4874
Article PK: 31466

Enan0 wrote in news:4356b787.7468.1681692777@sybase.com
of ianywhere.public.general:

Enan0> In Sybase i Try:
Enan0>
Enan0> "if not exists (select * from sysobjects where id =
Enan0> object_id('[RegMailMapp]')) then"

Should just be:

if not exists (
select *
from sysobjects
where id = object_id('RegMailMapp')
) then
--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng9 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm

Developer Community / Whitepapers
http://www.ianywhere.com/developer

CaseXpress - to report bugs
http://casexpress.sybase.com

CodeXchange - Free samples
http://ianywhere.codexchange.sybase.com/servlets/ProjectDocumentList