Storage Of Varying Data Types In SQL

Jun 2, 2001

re: [Windows 2000 SP1, SQL Server 7.0 SP2]

I am developing an online web-based address book for multiple users. There are STANDARD FIELDS and CUSTOM FIELDS.

Standard fields include: Name,Street,City,State,Zip.
Custom fields are those defined by a specific user. For example:

User-A Custom fields:
Interest Rate <real>
Loan Amount <currency>
Start date <date>

User-B Custom fields:
Blood type <char 3>
Date of birth <date>
Referred by <varchar 50>

Different users can have different custom fields in their address book. As you can see, while the standard fields for each user can be

stored in a single table. However, I have several methods by which I can store the CUSTOM fields.

------------------------------------------------
Method 1: Create 2 separate tables called CustomField and CustomValue:

CustomField has fields:
FieldID <int>
FieldName <varchar 25>
UserID <int>

CustomValue has fields:
ValueID <int>
Value <varchar 50>
FieldID <int>

------------------------------------------------
Method 2: Create a separate Field and multiple Value tables for each data type:
CustomField, CustomCharValue, CustomIntValue, CustomMoneyValue, etc...

CustomField has fields:
FieldID <int>
FieldName <varchar 25>
FieldType <smallint> (determines which TABLE, below, contains the data)
UserID <int>

CustomCharValue
CharValueID <int>
IntValue <Varchar 50>
FieldID <int>

CustomIntValue
IntValueID <int>
IntValue <int>
FieldID <int>

etc....etc...


The structures of those tables would be similar to Method 1, but the data would be segregated based on their data type.

--------------------------------------------------

I'm thinking that while Method 1 will be easier to implement, Method 2 may offer me better performance if coded correctly. I'm going

to assume that I'll have at least 1-5 million records to work with over the course of my first year and I will need the ability to sort

records based on values in the custom fields as well.

My first question is: Which method should I be considering and is there an alternative or hybrid that I should be considering?

My second question is: What statements should I use in my stored procedure that will enable me to retrieve a list of USERID, CustomFieldIDs and their values as one resulting table that I can query at will and with solid performance?

Gregory
email: sqlGuy@clubtel.com

View 1 Replies


ADVERTISEMENT

MSSQL: Storage Of Varying Data Types

Jun 2, 2001

I am developing an online web-based address book for multiple users. There are STANDARD FIELDS and CUSTOM FIELDS.

Standard fields include: Name,Street,City,State,Zip.
Custom fields are those defined by a specific user. For example:

User-A Custom fields:
Interest Rate <real>
Loan Amount <currency>
Start date <date>

User-B Custom fields:
Blood type <char 3>
Date of birth <date>
Referred by <varchar 50>

Different users can have different custom fields in their address book. As you can see, while the standard fields for each user can be

stored in a single table. However, I have several methods by which I can store the CUSTOM fields.

------------------------------------------------
Method 1: Create 2 separate tables called CustomField and CustomValue:

CustomField has fields:
FieldID <int>
FieldName <varchar 25>
UserID <int>

CustomValue has fields:
ValueID <int>
Value <varchar 50>
FieldID <int>

------------------------------------------------
Method 2: Create a separate Field and multiple Value tables for each data type:
CustomField, CustomCharValue, CustomIntValue, CustomMoneyValue, etc...

CustomField has fields:
FieldID <int>
FieldName <varchar 25>
FieldType <smallint> (determines which TABLE, below, contains the data)
UserID <int>

CustomCharValue
CharValueID <int>
IntValue <Varchar 50>
FieldID <int>

CustomIntValue
IntValueID <int>
IntValue <int>
FieldID <int>

etc....etc...


The structures of those tables would be similar to Method 1, but the data would be segregated based on their data type.

--------------------------------------------------

I'm thinking that while Method 1 will be easier to implement, Method 2 may offer me better performance if coded correctly. I'm going

to assume that I'll have at least 1-5 million records to work with over the course of my first year and I will need the ability to sort

records based on values in the custom fields as well.

My first question is: Which method should I be considering and is there an alternative or hybrid that I should be considering?

My second question is: What statements should I use in my stored procedure that will enable me to
retrieve a list of USERID, CustomFieldIDs and their values as one resulting table that I can query at will and with solid performance?

Gregory
email: sqlGuy@clubtel.com

View 1 Replies View Related

Storage Of Text Data Types

Jan 2, 2014

I trying to fully understand when to use different data types in sql server.I want to know what Microdoft means when they say"Varchar is the actual length of the data entered plus 2 bytes".example e.g. what would the storage of varchar (50) be?

View 7 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

Java Code To Retrieve Data From Stored Procedure Which Returns Cursor Varying Output?

May 11, 2015

java code to retrieve the data returned by SQL server stored procedure which is of CURSOR VARYING OUTPUT type and display the details on console.

View 3 Replies View Related

SQL 2012 :: Distinct Storage Tier Of Remote BLOB Storage (RBS)

Oct 27, 2014

How to implement distinct storage tiers on SQL Remote BLOB Storage (RBS)?

I want to use this SQL Feature to move files(images, videos, pdf files) from a database to a distinct database dedicated to RBS. Then I want to have several storage tiers, where objects will be saved and moved according access frequency. Old data will be arquived in cheap storage, but it must be always accessible if needed.

Description:
- 1st and main tier: new and frequently accessed objects stored in high performance storage;
- 2nd tier: automatically move older or less accessed objects to an inexpensive and different storage tier;
- in all cases, all objects must be accessible to all users, but accessing to archived objects(2nd tier) will be much slower;

View 0 Replies View Related

How Many Data Can Storage Into Sql Ce

Mar 16, 2007

Hi,

i want to know how many data can storage into sql server compact edition. I've got a db into a pocket pc that has a table with about 2000 records inside; are they too records?

View 5 Replies View Related

Un Limited Data Storage

Aug 29, 2005

hi all,
I have a field which name is Information
and it type is Varchar (8000),but some time data access than 8000 character, my client told me,make this field to store Unlimited data.
So how can i achive this task, i m using VS 2003 (ASP.NET with VB.NET) with SQL 2000.
Thanks
Shally

View 2 Replies View Related

XML Data Type Storage

Nov 22, 2006

Hi All,As per BOL, XML data type can store up 2 GB of data.My question is when a row is inserted in a table, for its xml column,2GB of space will be resered.In other words, how xml is internally stored. Is storage allocation issimilar to varchar(max) data type?Thanks in advance for everything.

View 1 Replies View Related

Storage For Data And Logs

Apr 2, 2007

I am planning on doing database mirroring using two (2) servers for each instance and a SAN to store the data and log files for both the primary server and mirrored server. How do I arrange the SAN 4 Physical Drives?
My options are:
· 2 Raid 1 Mirrors giving 250 GB to each SQL engine €“ This though has both the transaction logs and data on the same physical drive even if we split it up further into logical drives
· A Raid 10 - The transaction logs and data can be on separate drives
· A Raid 5 using the 4 Drives. (How SQL will see these drives I€™m not sure when it€™s 2 SQL engines)
· Or I could get a 5th drive and have a mirror set for transaction logs and a RAID 5 configured for the data.

View 3 Replies View Related

Dumb Data Storage Question

Dec 13, 2006

Hello, So, here's my dumb question; if I wanted to store some *.gif images in some database (SQL2K possibly 2K5) field and wanted to pull the information from that to display on the web form, am I actually storing the image in the database or am I storing the location of the image in the database?I ask this because I was under the impression that the location to the image file is what was being stored but another person was saying that it was the actual image. I guess I'm confused... Thanks in advance.... 

View 4 Replies View Related

Indexing And Physical Storage Of Data

Aug 28, 2007

1> How is the data stored physically when there is now primary key as well as any index defined in the table......?

2> How is the data stored physically when there is just a primary key defined in one of the column of the table? No INDEX defined.




Thanks,
Rahul Jha

View 1 Replies View Related

Strategy For Data Storage/searching

Dec 16, 2007

Hello there,

Don't know if this is the right forum to be asking this, but I'll give it a try...

I'm relativelly a beginner in SQL Server and T-SQL in general. The problem I'm trying to solve is the following:

The big picture is that I have data coming from different data sources which I need to store on a database for later reference. Each data source might have a different set of measurements. For example, data source 1 might log Pressure and Humidity while data source 2 logs Pressure and Temperature. Once the data is present on the DB, the users can go ahead and retrieve data for a given [datasource/measurement/time interval] to generate reports or charts.

My implementation so far consists of two tables: series_info and series_data. series_info holds general information for a given series of measurements for a given data source (Pressure for data source 1, Pressure for data source 2, Humidity for data source 1 and Temperature for data source 2, in our example). Each series has a bigint index as primary key.

The table series_data contains all data relative to the series from series_info. Each piece of data has a bigint as a primary key, an associate time (which is always crescent) and a foreign key to the series it represents (in series_info).

Alright, everything is cool so far. However, whenever a user wants to retrieve data for given [data source/measurement/time interval], this takes very long, since all data is interposed in series_data and for every search it's necessary to find where the desired data actually lies.

One obvious solution for this would be to dynamically create a new table to hold the data for each series, but that would just make my database disorganized, since there would be thousands and thousands of tables.

Another thing that comes to my mind is to create a table with information of where lies the data for a given [data source / measurement] for given dates. So when the user requested data for a given [data source/measurement] between, say, january and february, we would first look at this intermediate table and find out that the data lies between indexes 1000 and 2000 on the series_data table, so the next SELECT command to series_data would already contain a restriction like WHERE index>=1000 and index<=2000. This should probably improve the speed of retrieval.

What do you guys (or girls) think? Maybe there's simply a classical solution for such a case.


Thanks in advance!

View 6 Replies View Related

SQL Express 2005 Data Storage Limitation

Sep 5, 2007

Hello,
I am designing a program for work with SQL Server express 2005. But I don't know what is the data storage limit in this version of SQL Server.
What i want is storing about 30000 records in a table of the database.
Hasn't SQL Server express 2005 any problem or restrictions for storing the data?
Please advice in this regards,
Thank you,
Mona 
 

View 3 Replies View Related

Differant Language OS And Data Storage In SQL Server

Oct 11, 2001

Dear Friends,

I am using SQL server 7 with ASP. I have two working environment means one is korean and second it english.
- one Korean OS server have SQL server 7.0 and it is my database server
- second Korean OS server is only webserver
- English OS is win2k and it is only Web server.


1) When i used both Korean server as my webserver + database server then there is no problem to add Korean Data to SQL server On korean OS.

2) But when I try to user English OS server as my webserver and Korean Os server as my database server then I am not able to store Korean Data in Database server insted of it stored some mis/junk/acssi characters in database.

-- I allready try with Korean version of MDAC of English os
-- I also try with OEM feature in SQL server client network utility
-- When I am use CODEPAGE in my .ASP page then data storage work fine .. but at the time of getting it back there is problem.



If u need any more information about problem then let me know.

So please help me in this regards.

Thanx in advance
Anis Vora
Partner
Global SoftWeb Solutions
www.globalsoftweb.com

View 1 Replies View Related

Can't Install IBM Tivoli Storage Manager Server On Windows 2003 X64 Storage Server, How Can I Fix The Pkg?

Jan 14, 2008

I am a Windows developer for the IBM Tivoli Storage Manager Server (TSMS) product.
Our product installation is built with InstallShield and uses the Windows Installer.

On a new installation of Windows 2003 x64 Storage Server R2, at a customer's site, the TSMS product fails to install.
The install of the OS has version 3.01.400.3959 of the Windows Installer and I see no newer version that installs.

Part of our product is 32 bit (console) and another part is x64 (server).
When installing I can see that the install's default is being redirected/reset to C:Program Files (x86)TivoliTSM after it is explicitly set by a custom action to ..Program Files.. . I further observe that our custom actions to write 64 bit registry entries are being refused.

REGSAM samMask = KEY_ALL_ACCESS;
if ( regIsWow64Process () ) samMask = samMask | KEY_WOW64_64KEY;
lStatus = RegCreateKeyEx( hLocalConnectKeyRoot,
szSubkey,
0L,
NULL,
REG_OPTION_NON_VOLATILE,
samMask,
NULL,
hKey,
&dw ) ;
The above fails to create the key.

We have tried four versions of our TSMS spanning many changes but the install acts the same.
This does not happen on any other Windows OS we test on but we do not test on Windows 2003 Storage Server R2 being that it is an OEM product. We did test on Windows server 2003 R2 x64 and do not see this problem.

Do you have any suggestions on how to tackle this problem?
I have full installation traces but can only see that the registry work is being refused. I can't see why.

View 1 Replies View Related

Reporting Services :: Table Data Types For Data Driven Subscriptions

Jun 11, 2015

I am trying to find a reference for a client that lists the fields available to be substituted into a data driven subscription from the query, along with the expected data types.  For example, the field on whether or not to include a link to the report seems to be expecting a bit data type.I have searched and can't seem to find anything.  I guess I could walk through the interface and try different data types, but if  a list exists, that would be better. 

View 4 Replies View Related

Mapping Of SQL Server Data Types To Integration Services Data Type

Oct 14, 2005

Does anyone know of any cross-references between SQL Server data types and the new data types introduced with SQL Server Integration Services? 

View 6 Replies View Related

Reporting Services :: SSRS Export To Excel Showing Data Type As General For All Data Types

Sep 16, 2015

One of my report has different data types like decimal,percentage and integer values.

When I exported the report to excel , all the values are showing as "general" data type.

How to get excel data type same as ssrs report data type by default when exported to excel?

View 2 Replies View Related

Data Access :: Validation For Length Of The Character Data Types

Jun 10, 2015

I Have a table with #Sample like below

=================================
#Sample
id int,
SSN varchar(20),
State varchar(2)
 
Sample Data:

ID SSN STATE
1 999-000-000 AB
2 979-000-000 BC
3 995-000-000 CD
=================================

We used filter logic based on the SSN & State.

We are passing these values through variables like

Declare @State varchar(2)
Declare @SSN varchar(20)

While run time these values are lets suppose @SSN = '999-000-000' & @State='ABC'

Now the Result is displayed with the state data Like 'AB' only.

Output: 1 999-000-000 AB

instead it should give system generated error.

Here I have 2 Questions:
1. Why it is taking 1st 2 Charecters?
2. Why it does not have any system generated for length?

I can do validation with Length function for these 2 variables however if have 100 variables then it should not feasible case. So, what is the reason behind? 

View 5 Replies View Related

T-SQL (SS2K8) :: Load Data From Flat File Source Into OleDB Destination By Changing Data Types In SSIS

Apr 16, 2014

I have an source file and i have to load it into the data base by changing datatype of the columns in ssis

View 1 Replies View Related

Modifying Data Column Names And Data Types

Mar 13, 2008

I'm in the process of converting a rather huge VSAM database into a set of SQL tables.
I am using the same data names from the mainframe (like XDB-NAME to RDB-NAME).
I load the files using Import Export Data and it makes the tables with such column names as col001, col002, col003, etc... and always sets the data types to varchr(255).
And I have to cut and paste the data names from the manframe side to the server side (and the data types to.) 
So, is there an easier way to do this? Or am I doomed to cut-n-paste my days away...
Thanks for any help.
 
 
 

View 2 Replies View Related

Design Data Storage For Feature Similar To Facebook Groups

Mar 13, 2008

Ok so facebook groups have 100,000's of members. Members can be part of an unlimited number of groups, and a group can have an unlimited number of members.

Comma Deliniated String seems absurd. Many-2-Many Database relationship seems like it won't scale well t the 10's of thousands and 100's of thousands of members (especially if you have 1000-5000 groups). A table for each group would work but thats a bit over the top in my opinion. XML file doesn't seem to be any better than the above options.

I am no database guru, but I can't figure out a scalable method of doing this, be it with or without a database. I need something that can support 10 groups that have 20 members each OR 1000 groups with 100,000 members each.

Any help, suggestions, or kicked in the right direction would be most appreciated.

View 3 Replies View Related

SQL 2000 DTS Package Data Storage -- What Table(s) Is This Information Stored In?

Aug 22, 2007

I need to generate a report of DTS package results, i. e. succeed, fail, error, etc. What tables is information of this type stored for SQL 2000?

winniemax

View 3 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

Copying Data From One Table To A New One With Some Different Data Types

Mar 30, 2007

Is it possible to easily copy data from one table to another if the data types don't match.   I know you can do a INSERT INTO table1(col1,col2)  SELECT (col2,col7) FROM table2 if the data types match but is there a way to do this if they don't. I'm not trying to copy date times into bit fields or anything.  I just have an old table that I built when I really didn't know what I was doing now I at leastthink I have a better understanding of what data types to use, so I was wanting to move the data in the orignal table to my new one.  Most of the fields in the olddatabase are text datatypes and the new database is nvarchar(50) data types.  Thanks for any suggestions. 

View 4 Replies View Related

Transact SQL :: Manage Max Table Storage Space In Case Of Excess Data (size In GB)

Apr 23, 2015

I am using sql server 2008 r2 on my end. I have created a database named testDB. I have a lot of tables with some log tables in this. some tables have contain lack of records in log table.

So my purpose is that I want to fix the table size of those tables(log tables) and want to move records in other database table placed on another location. So my database has no problem.

is there any way to make such above steps which I want for my database?

Is there already built any such functionality in sql server?

View 2 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

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

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

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