Choosing Data Types Correctly
Sep 18, 2004
Hello, I am really dripping wet behind the ears on this and would really appreciate some help. I am setting up my first SQL table and am lost at trying to choose data types for my fields. Basically, all I am doing is setting up a contact form. It is going to ask for phone number, name, address, city, state, zip, etc. I will also have two fields which if I were using an Access db, would be "memo" with say, 500 characters. So in researching SQL data types, I came across the following:
char
Fixed-length non-Unicode character data with a maximum length of 8,000 characters.
varchar
variable-length non-Unicode data with a maximum of 8,000 characters.
text
Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters.
nchar
Fixed-length Unicode data with a maximum length of 4,000 characters.
Can someone shed some light on what I need for simple fields like street, name, city, and more importantly, description? I will also have a "premium" field which should be a "yes" or "no". I am thinking a data type of bit, which is set to 1 or 0? Thanks for any help, I appreciate it so much.
TOm
View 1 Replies
ADVERTISEMENT
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
Apr 15, 2006
Hi ... I have question on datatype on SQL Server 2005 EE
What is a good data type for email, password, Phone Number and ISBN number?
Thanks!
View 3 Replies
View Related
Jan 12, 2007
Hi everyone
Primary platform is 2005 on 64-bit.
I've got a couple of questions linked to partitionating tables.
-What sort of criteria follows Database Engine when you have two NDF assigned to one filegroup and this filegroup is part of partition
What's more: Could I force that Sql will use one by default?
I mean, my first partition encompass from 20020101 till 20030101. When I add data for example March or June, could I decide that these months belong to NDF1 rather than NDF2?
Let me know if you need further details.
Thanks in advance for your time,
View 4 Replies
View Related
Oct 22, 2007
I have the following query in an ExecuteSQL Task:
Insert Into Table2
Select * From Table1 Where Column1Val = '4'
As you can see, I don't need any parameters so I havent configured any. Also, there should not be any result set so I shouldnt need to configure a resultset parameter.
Why is the above query failing with
Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly
View 4 Replies
View Related
Apr 21, 2014
I am using SQL Server 2012 and to me a part of data captured by CDC is not making sense.
I have a table called 'Schema.Table1', and I enabled CDC on it by running 'sys.sp_cdc_enable_table'. I see that a table called 'cdc.Schema_Table1_CT' got created which now gets an entry when ever I Insert, Update or delete a record in the original table.
Till this point every thing works fine.
My original Table has a NOT NULL INT column called 'AuditTrackerUserID' with a default value of 1996. My application does not provides a value for this column, but because the column itself has a default value, records get inserted without error.
When I try to execute the following Query I see multiple records with __$operation of 3 and 1.
SELECT * from cdc.Schema_Table1_CT where AuditTrackerUserID IS NULL
My expectation is that I should not ever see any record returned by this query because AuditTrackerUserID is a not null column, but I do.
View 2 Replies
View Related
May 16, 2008
Hi everyone,
I'm having some problems importing a CSV to a db in SQL Server
Consider the following csv input
"1102","Spiderman, New York City",
"1103","Superman, Metropolis",
"1104","Batman, Gotham City",
When I select comma as delimiter, the columns will automatically
be offset since the location includes commas as well. How do I correctly
set the delimiter?
I tried using the following as delimiter → ","
but that'll strip the quotes which are required in this case.
Does anyone have an idea how to resolve this?
View 8 Replies
View Related
Jan 24, 2004
HI all.
I have a web service that does an SQL select against a database that contains international data, however when this is displayed from the web service the text such as "Rue Emile Féron 168" is not shown correctly and the 'é' is shown as a comma. Can someone advise what changes I need to make to the coding. Also our own tables have varchar fields and I'm assuming the "é" data will be saved correctly ???
Thanks
View 4 Replies
View Related
Feb 26, 2008
Ok I wrote a SSIS package that will pull down data from my AS/400 and populate a SQL Server table with the data.
1)The data is being pulled from my China configured AS/400. It is configured to handle DBCS
2)The SQL Server tables are configured to handle DBCS by using the nvarchar datatype.
3)When I run this package on my machine against the production server, it works perfectly.
4)When I run this package on my test SQL Server against the production server,it works perfectly.
5)When I run this package on my production SQL Server it brings down all the records, but does not bring down all the fields. Most of the character fields are left blank.(not all)
I do not understand why this is doing this. Can anyone shed any light on this problem? Thank you.
View 2 Replies
View Related
Feb 26, 2008
Ok I wrote a SSIS package that will pull down data from my AS/400 and populate a SQL Server table with the data.
1)The data is being pulled from my China configured AS/400. It is configured to handle DBCS
2)The SQL Server tables are configured to handle DBCS by using the nvarchar datatype.
3)When I run this package on my machine against the production server, it works perfectly.
4)When I run this package on my test SQL Server against the production server,it works perfectly.
5)When I run this package on my production SQL Server it brings down all the records, but does not bring down all the fields. Most of the character fields are left blank.(not all)
I do not understand why this is doing this. Can anyone shed any light on this problem? Thank you.
View 6 Replies
View Related
Feb 14, 2008
Ok I wrote a SSIS package that will pull down data from my AS/400 and populate a SQL Server table with the data.
1)The data is being pulled from my China configured AS/400. It is configured to handle DBCS
2)The SQL Server tables are configured to handle DBCS by using the nvarchar datatype.
3)When I run this package on my machine against the production server, it works perfectly.
4)When I run this package on my test SQL Server against the production server,it works perfectly.
5)When I run this package on my production SQL Server it brings down all the records, but does not bring down all the fields. Most of the character fields are left blank.(not all)
I do not understand why this is doing this. Can anyone shed any light on this problem? Thank you.
View 10 Replies
View Related
Jul 23, 2005
I have the following code but do not know the best way to return the updatedDataTable back to the database. I believe I can use the Update method of theData Adapter, BUT if true, I also believe I have to 'long-hand' write codefor each individual column data that's being added......this seems a bitdaft considering that the data is already in the disconnected data table.Have I lost the plot?? Based on the code below, what is the correctapproach?Note: sqlcnn is defined at module level.Public Sub AddRequest(ByVal Eng As String, ByVal Bran As String, ByVal ReqAs String) Implements IHelpSC.AddRequestDim dtNew As New DataTable("dtNew")Dim drNew As DataRowsqlda = New SqlDataAdapter("SELECT * FROM ActiveCalls", sqlcnn)sqlda.Fill(dtNew)'Add and populate the new datarow with'data passed into this subroutinedrNew = dtNew.NewRowdrNew("CallTime") = Format(Date.Now, "dd MMM yyyy").ToStringdrNew("Engineer") = EngdrNew("Branch") = BrandrNew("Request") = ReqdtNew.Rows.Add(drNew)End SubHope one of you wizards can help.Rgds.....and Merry Christmas.Phil
View 2 Replies
View Related
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
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
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
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
Oct 16, 2007
I have a report that has ten pages (essentially ten different reports). Each page has one, large main chart and then three smaller charts stacked on top of each other off to the right. The layout is in landscape. When I render the report in Reporting Services, the layout looks fine. If I export it to Adobe, it is also fine. However, when the report is emailed as a PDF attachment, the main chart on each page is completely missing. Has anybody experienced something simliar? I was having issues with the layout, and decreasing the height of each page fixed everything, but created this new problem. I am using Adobe 7.0. Thank you.
View 1 Replies
View Related
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
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
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
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
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
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
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
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
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
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
Feb 14, 2008
Im comparing values. if i add the values which is numeric or monetary in the column and if it is greater than zero it will insert to a table, but the datatype of my column([Day 30 AMT] etc. is char. i want to implement like these like these because it cant return a result if i query..
FROM tbl1 a LEFT OUTER JOIN tb2 b
ON a.ID = b.ID
WHERE b.ID IS NULL AND
a.[Day 30 AMT] + a.[Day 60 AMT] + a.[Day 90 AMT] + a.[Day 120 AMT] + a.[Day 150 AMT] + a.[Day 180 AMT] + a.[Day 210+ AMT]) > 0
View 8 Replies
View Related
Mar 13, 2008
What is the difference between int and numeric data type in sql server 2000. When I should use which?
View 2 Replies
View Related
Jul 20, 2005
what is the equivalent data type of autonumber of access in sql server?
View 2 Replies
View Related
Sep 6, 2006
Hi,
I want to store a decimal value which I get from an execute sql task into a package variable. Which data type should I specify when creating the package variable?
Thanks,
Tom
View 8 Replies
View Related
Jan 4, 2007
I have successfully made a couple of SSIS packages to read data from a legacy AS400 to SQL Server 2005. These are working fine. I am now working on one that is trying to pull some financial data and I keep getting the following error for the decimal columns:
"The component ciew is unavailable. Make sure the component view has been created. The input column "input column AMT1 (2870) cannot be mapped to "external metadata column AMT1(2852) because they have different data types."
Now I made sure that the data sitting on the AS400 is of type decimal and the SQL server column is the same. What else do I need to look for?
Thanks for the information.
View 3 Replies
View Related
Oct 19, 2006
Hello, I am following this article about building an ASP.Net application which uses SQL Express 2005. The document calls for building a couple of tables. One column is identified with data type of "Byte" which are is available for selection within the Visual Studio 2005 interface. The following values show in the drop down of data type in VS2005:
Bigint
Binary(5)
Bit
Char(10)
DateTime
Decimal (18,0)
Float
Image
Int
Money
NChar(10)
NText
Numeric(18,0)
Nvarchar(50)
Nvarchar(max)
Real
SmallDateTime
SmallInt
SmallMoney
Sql_Variant
Text
Timestamp
TinyInt
UniqueIdentifier
Varbinary(50)
VarBinary(max)
varchar(10)
Varchar(max)
XML
I choose Char with a size of 1. Would this be correct, or am I missing something?
Thanks in advance for your assistance!!
View 1 Replies
View Related