Solved

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

Posted on 2011-09-13
3
281 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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.​
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

895 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

13 Experts available now in Live!

Get 1:1 Help Now