Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

828 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