Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-13
3
Medium Priority
?
293 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 200 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 1800 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

916 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