Storing Enum Types In SQL

Jan 21, 2008

I have an asp.net custom class which has a property using Enum types. For information, it is an "orders" class and the property is "status", with types:

OrderStatus.Open
OrderStatus.Completed
OrderStatus.Cancelled
OrderStatus.Refunded

each order is stored as a row in a SQL database table. How can I store the Enum type in the database?

I assume that I could have an integer column with values 0 - 4 and convert to and from the integer/enum type each time an order is read or written, but it would be much better if I could store the enum type somehow without having to convert.

Any ideas?

View 1 Replies


ADVERTISEMENT

Multiple Types Of Data Storing In SQL Server

Mar 22, 2007

Hello All,

We are developing customer support application. We will have so many customers after launching this product. But my problem is how will i store data of all these customers in SQL Server. Please suggest me.

View 1 Replies View Related

Are There No Computed Column Types? For Storing Expressions (results Of Other Fields)

Jun 4, 2006

I just read something interesting here: http://www.informit.com/library/content.asp?b=STY_Sql_Server_7&seqNum=101

A column type that helds an expression, and in queries returns the results.

That sounds excelent in my database, to save some code in my client applications. E.g adding price totals, and taxes of an order.

I can't find any info about this in later versions of SQL server. Is this not possible anymore?

View 3 Replies View Related

LinqDataSource Using Enum In Where?

Dec 30, 2007

Not sure where the best place to ask this question is so I will ask it here.  I am trying to use the LinqDataSource ASP.NET 3.5 control and am having a problem with using the Where attribute.  I have a field that I want to filter on that is an Enumeration, however if I try to put the integer value in the Where attribute the page will not compile.  How do I use enum values in the Where attribute?
I have something like this:
public enum EventType{    Charger = 0,    Location = 1,    Scanner = 2}
I want to filter the LinqDataSource like this:
<asp:LinqDataSource ID="DataSource1" runat="server"        ContextTypeName="MyDataContext"        Table="Events"        Where="EventType = 2" />
This won't work.  The EventType property is an instance of the enum type above.    

View 2 Replies View Related

Create Enum!

Feb 6, 2007

hi, i'm new to sql. Any idea how to make enum type in micr. sql server management studio 2005. I need something like this:

field_name char enum ('I', 'J', 'K')


pleaase help me!

View 4 Replies View Related

Enum Datatype In SQL Server?

Sep 21, 2007

hi guys,
is it possible to do a enum datatype in SQL Server? if so can anyone point me to an example please?
 
thanks,
benny
 

View 3 Replies View Related

Enum The Running SQL Instances Using DMO

Feb 12, 2008

Hello,

I want to enumerate all the RUNNING SQL instances[in a mixed env where SQL 2000 and SQL2005 are deployed] using SQL DMO.
But any of the following methods would not help

ListAvailableSQLServers Method
ListInstalledInstances Method

because they list all the installed instances and while my intent is getting only the running instances.

Is there any other direct API ? Pls advise.

Regards,
Velu

View 1 Replies View Related

Any MySQL ENUM Eqvivalent In MSSQL?

Aug 28, 2006

Hi,

Can't seem to find a similar data type in MSSQL like the one very handy ENUM type existing in e.g MySQL:

... Enum('on','off','standby') ...

It's also a convinient way to check for true/false. I'd appreciate any suggestions on possible "workarounds" or sources that might point me in the right direction.

Best

View 1 Replies View Related

In ADO What Is Diffrence Between Cursortype Enum Values

Nov 25, 2006

hi

what is the diffrence between the cursor type of the recordset enumeration values in ADO

dynamic
openkeyset
static
forwardonly

thanks in advance.

View 3 Replies View Related

How To Use Database Values In An Enum Or Class, So Developer Has Intellisense Support....

Jan 17, 2007

I have a SQL database table with all languages used in my application.
I would like to use an enum or constant class with all the languages, so every developer of the app sees directly what languages are available.
Can this be done?

View 5 Replies View Related

Sql Types - Simple SQL Server Queries/handling Variable Types

May 26, 2005

SQL Server 2000, ASP.Net 1.1

I've been writing this stuff for a while, and can't seem to come to the
conclusion of how I should be retrieving data and assigning this data
to variables.

Since i'm using SQL Server, I'm convinced that I should be using the
datareaders GetSqlDouble (or whatever) function, but this would mean i
need my local variables to be one of the SQL types.  The problem
with that is, that there will have to be lots of conversions done by me
to be able to use a SQL type in my application.

For instance, I have a class where i'm retrieving dates.  In order
to retrieve them correctly (Null values included), I need to retrieve
them with GetSqlDateTime(), then when it comes time to display the date
in a table, i must first check for nulls, then convert to a
string.  This seems to be very cumbersome.  Would I be better
off just using GetDateTime(), and the .ToString method, and ignoring
Sql Types all together?

so, basically, how are you guys using your sql server data?  with
the supplied sql types, and doing all of the post-processing work
manually?  I feel like i'm having trouble conveying my
issue...hopefully someone knows what i mean....i'd just like some
direction to save trouble in the long run, since i feel like there's
got to be a better way...

Confused!

Thanks,
JJ

View 1 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

One Or More Columns Do Not Have Supported Data Types, Or Their Data Types Do Not Match.

Oct 20, 2007



Hi,

I´m exporting an ms-excel file, then I use a lookup transformation to get a field from a SQL Server 2005 table. The Lookup transformation editor, after selecting the table, shows a warning that says:

at least one mapping between a column from available input columns ans a column from available lookup columns must be defined on the columns page.

So I try to make a relationship in the Lookup transformation editor's column tab where I find the Available input columns and the available lookup columns but I get the following error:

The following columns cannot be mapped:
[Department, DEP_CLEGALCODE]
One or more columns do not have supported data types, or their data types do not match.

The field in SLQ Server is varchar(10) and the input field is a derived column transformation; I have tried different Data Types but I always have the same error.

The DataFlow is: ExcelSource --> Derived Column --> Lookup --> Flat file destination

thanks.

View 6 Replies View Related

How Many Types Of UDF Are There?

Feb 4, 2006

Hi,
Please help me to know this question.
How many types of UDF are in SQL SERVER 2000?
Please tell me if anybody knows the answer.
Thanks in advance,
Joydeep

View 14 Replies View Related

SQL Types

Mar 13, 2004

HI i have a big problem i have an exericse to do on SQL for school but i havne tbeen told what they are. All i have to do is to match the follwing togehter and say why they would use it any ideas?

DDl-

DML-

DCL-

these need to be matched up to certain users:

Database administartor

Users

Application develpers any ideas

View 2 Replies View Related

About Sys.Types

Nov 29, 2007

in my work I use some "objects", that i tune using "Parameters"
So i have table MyObjects And ObjectParameters-OP
In the table OP i want field for Parameter Type(Type)... now i using type Varchar(63) and then i need for parameters of money type, i will get it by SELECT * FROM ObjectParameters WHERE Type = 'money'...
at the sql.ru i got an answer, where they suggest me using type "sysname", in MSDN i have found that it is equivalent nvarchar(128), i a cant find any differences between my solution and sql.ru solution.

AND main question is.. can i using ID for my types from View sys.types, And can i be sure that it will be the same ID in another version SQL Server (like 2000, 2008) or another installation of SQL Server for same type...

sorry if i have misstakes in my english...

Thanks In Advance...

View 6 Replies View Related

Storing SID&#39;s In SQL 7.0

Dec 16, 1999

I need to store a user ID of whoever made the last change to a record in a table. I have added a field with a default set to 'suser_sid()'.

Is it wise to store SID's in a database table if you are using NT authentication? My concerns are that if the user is deleted by the NT system administrator then I lose data integrety also if the database is backed up and restored onto a different machine with different users it won't work at all.

I'd be grateful for any help with this.


Rich

View 1 Replies View Related

Object Types In SQL

Jun 2, 2007

Hi,
 When creating a database in the Management Studio, you get to select the database owner, and should that be usually the Administrator and ASPNET account?Also, what is this Object Types option for? There seem to be only one "Login" option in there, what does that serve as?

View 2 Replies View Related

License Types

Sep 21, 2007

i want to check the price of sql server 2005 in my country as a consideration to take when deciding on wich db to build.i dont understand the licensing method. what 5 clt stands for ? whats the basic 64 bit 1 processor dual core license i need for a commercial website ? thanx, 

View 1 Replies View Related

SQL Data Types

Dec 29, 2004

Hello,

I have a really dumb question regarding SQL data types. I have a couple columns in a table that are specified as MONEY. These columns are being read from my web app and displayed on the website for reference when filling in other information.

My problem is that when it is displayed on the website it give four decimal places instead of two. For example I want it to report $33,000.29 but what is actually displayed is $33,000.2965.

How can I set up either SQL or my web app so that it only displays the two decimal places? I've looked into changing the datatype already but SMALLMONEY and MONEY have the same type of decimal values.

Thanks!

View 3 Replies View Related

Cant Convert Types

Mar 7, 2006

I ham trying to convert a 'System.Data.CommandType'  to 'System.Web.UI.WebControls.SqlDataSourceCommandType'.
 
but I get
Error 4 Cannot implicitly convert type 'System.Data.CommandType' to 'System.Web.UI.WebControls.SqlDataSourceCommandType'. An explicit conversion exists (are you missing a cast?) D:InetpubwwwrootHelp_DeskApp_CodeHelpDeskSql.cs 99 42 http://localhost/Help_Desk/
My problem is I cant seem to get a explicit conversion to work. if it cast it I get an.
Specified argument was out of the range of valid values.Parameter name: value . when running the page. but no build errors, does anyone know how to cast this?

View 2 Replies View Related

XML Encoding Types

Jun 12, 2006

Hi,
I am getting this error: {"XML parsing: line 1, character 43, unable to switch the encoding"} System.Data.SqlClient.SqlException  when I run the code below. 
I know it is caused by the fact that the encoding of the XML file I'm trying to insert is not utf-16, but rather utf-8.  However I would like to be able to enter any encoding.  Is this possible? 
If not is there a way to convert the encoding before I insert?  Or any other ideas anyone might have.  Thanks!
XmlDataSource xds = new XmlDataSource();
xds.DataFile = tbLink.Text.Trim();
xds.XPath = "rss/channel/item";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc = xds.GetXmlDocument();
string strConn = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
sqlComm.Parameters.Add(new SqlParameter("@XMLData", xmlDoc.InnerXml));
strSQL = " INSERT INTO tblCastStore ( intCastID, CastXML ) VALUES ( @@IDENTITY, @XMLData );";
sqlComm.CommandText = strSQL;
try
{
sqlConn.Open();
sqlComm.ExecuteNonQuery();
sqlConn.Close();
}
catch (SqlException se)
{
lblError.Text = se.Message;
}

View 2 Replies View Related

Cursor Types

Aug 7, 2001

I hope someone can help me.
I am running a visual basic program which creates a recordset based on a stored procedure. No matter what cursor type I set I always end up with a static cursor on my recordset. I think the stored procedure is over-writing the cursor type. As I know very little about TSQL, I don't know how to fix this.
Any Ideas?

Barney

View 1 Replies View Related

Data Types

Aug 29, 2001

I am looking for a chart of SQL Server data types and information about them, such as usage, constraints, etc. Could anyone point me in the right direction?

Thanks

View 1 Replies View Related

SQL 7 Data Types

Oct 2, 2000

I'm just getting used to using SQL 7 Database and am looking for some recommendations on what DATA TYPES to use when designing tables.

The site I am working on now uses cold fusion to enter, update, and insert mainly text and articles. Now the problem with the articles is that some of them are pretty big. And when inserting or updating them, if they go over the limit of characters I get an error.

I know in access I used to use the data type "MEMO" and be able to put a large piece of info in that field.

What's the equivalent for SQL server databe?

What are the most used/common or recommended data types that should be used when putting tables together?

Thanks

George

View 2 Replies View Related

Collation Types

Jun 24, 2003

Hello, dear Friends!
My situation is a following:
I have some not big databases with only English data and some conteining data in Hebrew.
My question is: May I manage two collation types- meaning the database collation type will be for example some kind of Latin and some databases' collation will be in Hebrew.
If you have any experience of managing DB's in two absolutely different languages (Japanesse, Russian, Chinesse, Arabic with English) please tell me about it.
Best regards.
Marina.:rolleyes:

View 5 Replies View Related

Help With Appropriate Data Types..

Nov 21, 2003

hi, i'm trying to build an online forum using sql server 2000 and coldfusion mx.

could anybody help me as to what datatypes i should use for my database fields?

i'll be using 2 simple tables to start with, ie TOPICS and POSTS. each will contain fairly basic information such as name of poster, time, data, title, message etc.

any help would be greatly appreciated.
thanx, zaffi.

View 4 Replies View Related

Data Types Help?

Jun 9, 2004

Which data type do I need to assign to my field to let users enter characters such as +=-_| etc....pretty much every single character from a standard keyboard....

thanks

View 2 Replies View Related

Character Types

Nov 16, 2007

i am using sql server 2000, i am new to databases, could you please tell me what are the different character types, example "varchar , numeric...etc"
How to find out the difference between them....
Where do i find a tutorial for this kind of basic knowledge ?

regards

View 14 Replies View Related

Counting Bit Types

Apr 23, 2008

I have a table that I want to use for reports that holds these datatypes

safe: Integer
unsafe: Integer
made_safe: Bit
unobserved: Bit

Which gets populated.

I want to count the values in each field but Bit fields seem to be awkward. This is my attempt

SELECT
SUM(safe)as TotalSafe,
SUM(unsafe)as TotalUnsafe,
COUNT(Case WHEN unobserved = 1 THEN 1 ELSE NULL END)as NotSeen,
COUNT(Case when made_safe = 1 THEN 1 ELSE NULL END) as TotalMadeSafe

FROM myTable

Any ideas please

View 3 Replies View Related

Types Of Edition

Sep 13, 2006

Hi All,

I want to know how many types of edition available for SQL2000 and SQL2005 respectively.

thanks.

View 7 Replies View Related

Mix Several Replication Types Within DB

Mar 29, 2007

hello,

is it possible to have several replication types within the same database?
for example, for two tables i want "merge replication" with a central server, where twice a day data is merged?
and for three other tables, i want "transactional replication" with a central server, where data is immediately inserted?

thanks

View 1 Replies View Related

Need Help With Data Types

May 10, 2007

Hi,

I am pretty new with SQL and was dabbling in a test database that is linked with a software application.

I made a change to a table - Lets call this (Table1).
Table1 has a multiple columns.

Column1 is defined as numeric(9)
Column2 is defined as varchar(20)

In this case, I wanted to make all values in Column2 = Column1 that did not have a value defined so I ran the following query:

update Table1 set Column2 = Column1 where Column2 = ''

This took effect but the particular software application doesn't recognize these values because they are the wrong data type.

How can I convert all data in a column to varchar(20) if it is another data type (i.e. in this case numeric(9))?

I've tried in Enterprise manager to redesign the table and adjusted the length to 21 and then back and saved it but this did not work. I was looking at Convert and Cast functions but don't know how to write one to accomplish what I need to do here.

Half of the data in Column2 is varchar(20) and half is numeric(9).
I want all to be varchar(20).

Thanks,

asyncd

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved