Solved

Store a value to the Database and not a table...

Posted on 2011-09-13
3
278 Views
Last Modified: 2012-05-12
MS SQL 2008.  

I am storing a current Version Id to my database, and it is just a single value.  I was hoping to not have to create a table just to house one value.  Is there an elegant solution for storing one single value to a special point in the system tables? Database Variables, sort of like session variables?

Ultimately, this has to do with an installation manager needing to know which version is currently installed.

If you have an answer, please provide how to set the value, and how to retrieve/update it, if it is not standard SQL.
0
Comment
Question by:hpdvs2
3 Comments
 
LVL 21

Assisted Solution

by:JestersGrind
JestersGrind earned 50 total points
ID: 36530035
Really the only way to store values on a permanent basis is in a table.  Having a table store one value is not that unusual.  You could make that table name general enough that maybe you store other similar values later.  

Greg

0
 
LVL 5

Accepted Solution

by:
DerZauberer earned 450 total points
ID: 36530121
I think a table is simply the best way to store a value!

Well of coz you could create a user defined function in your db returning this value or some other strange thing like that.

CREATE FUNCTION GetVersion
(
)
RETURNS double
AS
BEGIN
RETURN 1.2
END

Open in new window


retrieve:

EXEC GetVersion

Open in new window


0
 
LVL 8

Author Closing Comment

by:hpdvs2
ID: 36530295
Thanks, at present I would agree that the sproc seems to make the most sense.

Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now