Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Working with Oracle
»
declaring global variables
declaring global variables
Rate Topic
Display Mode
Topic Options
Author
Message
BeginnerBug
BeginnerBug
Posted Saturday, October 09, 2010 1:59 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Wednesday, October 31, 2012 1:16 AM
Points: 127,
Visits: 348
Hi,
In Oracle, we can set the public variable/constant/types/curosors in the Package specification, Could you please tell me that how to achieve the same functionality in the SQL server.
Thanks in Advance
Post #1001681
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
Posted Sunday, October 10, 2010 6:47 PM
Hall of Fame
Group: General Forum Members
Last Login: Today @ 3:56 PM
Points: 3,016,
Visits: 4,469
mail4sha (10/9/2010)
In Oracle, we can set the public variable/constant/types/curosors in the Package specification, Could you please tell me that how to achieve the same functionality in the SQL server.
There is not such a thing as a package in SQL Server but you use DECLARE statement to declare variables, etc. Check here...
http://msdn.microsoft.com/en-us/library/aa258839(SQL.80).aspx
Hope this helps.
_____________________________________
Pablo (Paul) Berzukov
Author of
Understanding Database Administration
available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #1001865
Vedran Kesegic
Vedran Kesegic
Posted Monday, March 07, 2011 5:34 PM
Old Hand
Group: General Forum Members
Last Login: Today @ 12:57 PM
Points: 343,
Visits: 1,089
No packages in SQL Server, unfortunately. Packages are one of Oracle advantages over SQL Server (do not start a war, please :) ).
But, you have several other options to make data shareable between procedures (beside obvoius: parameters):
#temporary tables
##global temporary tables
context_info - 128 bytes of connection-scoped data. varbinary(128), initially NULL.
declare @vb varbinary(128)
set @vb = context_info() -- read value
set context_info @vb -- set value
You can use e.g. one byte of the binary string for one variable, next four bytes for other variable etc.
Also, @table variables can be input parameters for procedure from sql2008 and up.
_____________________________________________________
XDetails Addin
- for SQL Developers and DBA
blog.sqlxdetails.com
- Transaction log myths - debunked!
Post #1074549
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.