Connecting Tech Pros Worldwide Forums | Help | Site Map

Oracle Sequence/Link 2 MS SQL SERVER 2005

ruediger.michels@feltengmbh.de
Guest
 
Posts: n/a
#1: Nov 30 '06
hi,

1. is there a statement in ms sql, what creates a sequence? cant find
anything in web :-(
-oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE
CACHE 20;
-ms sql: ???

2. hwo do i create a link to another ms-sql database

thx a lot need help, urgend :-)


Martijn Tonies
Guest
 
Posts: n/a
#2: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Quote:
2. hwo do i create a link to another ms-sql database
From one MS SQL to another MS SQL server? Or database?


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Martijn Tonies
Guest
 
Posts: n/a
#3: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Quote:
1. is there a statement in ms sql, what creates a sequence? cant find
anything in web :-(
-oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE
CACHE 20;
-ms sql: ???
Microsoft SQL Server doesn't have sequences. It does have some sort
of auto-increment integer thingy for columns, check out "identity" in the
documentation.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Hagbard
Guest
 
Posts: n/a
#4: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


thx Martijn

Hagbard
Guest
 
Posts: n/a
#5: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005



Martijn Tonies schrieb:
Quote:
Quote:
2. hwo do i create a link to another ms-sql database
>
From one MS SQL to another MS SQL server? Or database?
>
>
--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
the link is between two ms-sql servers

DA Morgan
Guest
 
Posts: n/a
#6: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


ruediger.michels@feltengmbh.de wrote:
Quote:
hi,
>
1. is there a statement in ms sql, what creates a sequence? cant find
anything in web :-(
-oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE
CACHE 20;
-ms sql: ???
>
2. hwo do i create a link to another ms-sql database
>
thx a lot need help, urgend :-)
The only other databases that have abilities similar to those of
an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Martijn Tonies
Guest
 
Posts: n/a
#7: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Quote:
the link is between two ms-sql servers
Set up a "Linked Server", check the documentation for that. It's really
easy to do :)


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Martijn Tonies
Guest
 
Posts: n/a
#8: Nov 30 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


1. is there a statement in ms sql, what creates a sequence? cant find
Quote:
Quote:
anything in web :-(
-oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE
CACHE 20;
-ms sql: ???

2. hwo do i create a link to another ms-sql database

thx a lot need help, urgend :-)
>
The only other databases that have abilities similar to those of
an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
And InterBase, Firebird, PostgreSQL, Mimer, ThinkSQL and probably some
others that
I don't know about :-)


btw, SEQUENCE is in the SQL 2003 standard.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


Tony Rogerson
Guest
 
Posts: n/a
#9: Dec 1 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


The only other databases that have abilities similar to those of
Quote:
an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
What about ROWNUMBER() in SQL Server 2005 and PARTITION??

--
Tony Rogerson
SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson - technical commentary from a SQL
Server Consultant
http://sqlserverfaq.com - free video tutorials


"DA Morgan" <damorgan@psoug.orgwrote in message
news:1164904167.680393@bubbleator.drizzle.com...
Quote:
ruediger.michels@feltengmbh.de wrote:
Quote:
>hi,
>>
>1. is there a statement in ms sql, what creates a sequence? cant find
>anything in web :-(
> -oracle: CREATE SEQUENCE XYZ INCREMENT BY 1 START WITH 1 NOCYCLE
> CACHE 20;
> -ms sql: ???
>>
>2. hwo do i create a link to another ms-sql database
>>
>thx a lot need help, urgend :-)
>
The only other databases that have abilities similar to those of
an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org

DA Morgan
Guest
 
Posts: n/a
#10: Dec 1 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Tony Rogerson wrote:
Quote:
Quote:
>The only other databases that have abilities similar to those of
>an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
>
What about ROWNUMBER() in SQL Server 2005 and PARTITION??
Totally different capabilities.

A sequence is not tied to a table: It is an independent object.

One can use a sequence to number count by any increment positive or
negative, assign the values to one table or to multiple tables, and
to repeatedly cycle through a fixed set of numbers (min to max and
back to min), and much more.

Maybe in SQL Server 2009?
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Tony Rogerson
Guest
 
Posts: n/a
#11: Dec 2 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Oh - you mean SQL Server 2007? Remember Mark Souza committed themselves to a
2 year release cycle....

If I sat down and worked it out then what we have now in terms of CTE's,
table structures, triggers I could do it - sadly, no time [at mo].

--
Tony Rogerson
SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson - technical commentary from a SQL
Server Consultant
http://sqlserverfaq.com - free video tutorials


"DA Morgan" <damorgan@psoug.orgwrote in message
news:1164990743.577953@bubbleator.drizzle.com...
Quote:
Tony Rogerson wrote:
Quote:
Quote:
>>The only other databases that have abilities similar to those of
>>an Oracle SEQUENCE are DB2 and Informix (only the most recent release).
>>
>What about ROWNUMBER() in SQL Server 2005 and PARTITION??
>
Totally different capabilities.
>
A sequence is not tied to a table: It is an independent object.
>
One can use a sequence to number count by any increment positive or
negative, assign the values to one table or to multiple tables, and
to repeatedly cycle through a fixed set of numbers (min to max and
back to min), and much more.
>
Maybe in SQL Server 2009?
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org

Serge Rielau
Guest
 
Posts: n/a
#12: Dec 2 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Ruediger,

How is the sequence used in the app?
While it is true that sequences are divorced from tables teh majority of
usages that I know of is for one of two purposes:
* Generate unique value across the database. If that's the case I would
look at GUID.
* Generate an abstract primary key for a specific table (or many tables,
but without actual requirement for x-database uniqueness).
In that case IDENTITY columns are the way to go.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Erland Sommarskog
Guest
 
Posts: n/a
#13: Dec 3 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Tony Rogerson (tonyrogerson@sqlserverfaq.com) writes:
Quote:
Oh - you mean SQL Server 2007? Remember Mark Souza committed themselves
to a 2 year release cycle....
Mark Souza? You are probably thinking of Paul Flessner.
Quote:
If I sat down and worked it out then what we have now in terms of CTE's,
table structures, triggers I could do it - sadly, no time [at mo].
Itzik Ben-Gan has come up with an idea where you us an table with a single
identity column. You have a stored procedure that either starts a
transaction, or if a transaction is already in progress, it issues a
SAVE TRANSACTION. The procedure then inserts a row into the table and
retrieves the identity value with scope_identity(). Finally it rolls
back the transaction, either entirely or to the savepoint. Thus, table
is always empty, but it still produces a growing sequence. Since the table
is locked for only short duration, the concurrency is good.

A fairly convoluted solution, and likely to be less efficient than what
they have on Oracle.

Then again, in many cases a plain IDENTITY column will do.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
David Portas
Guest
 
Posts: n/a
#14: Dec 3 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Erland Sommarskog wrote:
Quote:
Itzik Ben-Gan has come up with an idea where you us an table with a single
identity column. You have a stored procedure that either starts a
transaction, or if a transaction is already in progress, it issues a
SAVE TRANSACTION. The procedure then inserts a row into the table and
retrieves the identity value with scope_identity(). Finally it rolls
back the transaction, either entirely or to the savepoint. Thus, table
is always empty, but it still produces a growing sequence. Since the table
is locked for only short duration, the concurrency is good.
>
A fairly convoluted solution, and likely to be less efficient than what
they have on Oracle.
>
Itzik's article is here:
http://www.sqlmag.com/Article/Articl...ver_48165.html

It does overcome some of the disadvantages of an IDENTITY column and
I've used variations of it very successfully. I am looking forward to
the day when we get an engine-level implementation of sequences and I
never have to use an IDENTITY column again.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
--

Tony Rogerson
Guest
 
Posts: n/a
#15: Dec 5 '06

re: Oracle Sequence/Link 2 MS SQL SERVER 2005


Good stuff.

Nope - it was Mark Souza at TechEd / IT Forum last year; there is a press
release somewhere.

--
Tony Rogerson
SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson - technical commentary from a SQL
Server Consultant
http://sqlserverfaq.com - free video tutorials


"Erland Sommarskog" <esquel@sommarskog.sewrote in message
news:Xns988EAF2CAD53EYazorman@127.0.0.1...
Quote:
Tony Rogerson (tonyrogerson@sqlserverfaq.com) writes:
Quote:
>Oh - you mean SQL Server 2007? Remember Mark Souza committed themselves
>to a 2 year release cycle....
>
Mark Souza? You are probably thinking of Paul Flessner.
>
Quote:
>If I sat down and worked it out then what we have now in terms of CTE's,
>table structures, triggers I could do it - sadly, no time [at mo].
>
Itzik Ben-Gan has come up with an idea where you us an table with a single
identity column. You have a stored procedure that either starts a
transaction, or if a transaction is already in progress, it issues a
SAVE TRANSACTION. The procedure then inserts a row into the table and
retrieves the identity value with scope_identity(). Finally it rolls
back the transaction, either entirely or to the savepoint. Thus, table
is always empty, but it still produces a growing sequence. Since the table
is locked for only short duration, the concurrency is good.
>
A fairly convoluted solution, and likely to be less efficient than what
they have on Oracle.
>
Then again, in many cases a plain IDENTITY column will do.
>
>
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Closed Thread