I've inherited a monster database that needs updating. It has a field called Birthdays that has been a text field and I want to convert it to datetime. The data entry people have been sloppy from time to time and some of the values generate errors when you try and change datatypes. Is there a way to change the datatype and have the oddball values left blank without bombing out the conversion process?
Having a slight problem. For whatever reason I had a column setup for nvchar but the only data i have in there is dates (MM/DD/YY) and a whole bunch of NULLs. I wanted to change the datatype to datetime but it gave me an error. I thought it was due to all the NULLs, so I removed all the nulls. It still doesn't work. I get the error : Conversion failed when converting datetime from character string. I don't belive its because I have the data in mm/dd/yy format. I created another table and populated it with mm/dd/yy data as nvchar (50) and then converted to datetime and it worked fine. any ideas?
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
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.Â
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?Â
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.
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...
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.
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.
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?
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?
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.
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....
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).
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..
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?
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?
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?
Is there some type of resource that tells you what all the Data types are and what they are used for. For example, whats the diffrence between Nvarchar and Char? Things like that. Thanks!
Hey guys, I have a table with the following information. A1,A2,A3,A10,A11,A12,A14,A20,A21B1,B2,B3,B10,B11,B12,B14,B20,B21C1,C2,C3,C10,C11,C12,C14,C20,C21Now if I assign this field as a char,varchar,text field then when sorting it turns outA1,A10,A11,A12,A14,A2,A20 etc. So in order to go around this issue, I placed a blank ' ' (space) before the items that are less than 10 so that it'll sort as' A1', ' A2', ' A3' , 'A10' etc. However, now the problem is since the B and C series also have this space it actually sorts as' A1', ' A2', ' A3', ' B1', ' B2' ... 'A11','A12' etc. Now, I know why it is doing that. I'm trying to figure out if there is a solution to this issue. I've considered having two fields instead, one for the letter and another for the number, However, I need to display them together and I also need to do some reporting on these figures, so even if i concatenate the two fields together, it'll be a string field and sort by the same way. Any ideas?
Hello all. I am a newbie to the world of setting up SQL databases, so please forgive my ignorance.
I have a nice website for social workers to enter encounters with clients. The social worker has to provide very detailed notes about the encounter. I have set up a textarea to take in all of this information. I am wondering which is the best data type to use for the table that this information will be dumped into. I am currently using text, but I don't want to waste space on the server with whitespace. Is this the best way to go? It is not uncommon for upwards of 5000 characters to be entered. This site is powered by ColdFusion, if that makes any difference.
I've got a float data type in a table. I imported data from a csv file. One value was 0.5195, but when I use the value in a calculation or select it using the Query Analyser, I'm getting a value of 0.51949999999999996. Is there any way around this, it's a real pain?
I currently run our company website using MS Access and ASP. I am trying to upgrade the database to MSSQL Server 2000. Unfortunately I'm not finding it that straight forward. I am trying to learn MSSQL but the learning curve is a bit steep.
I have a column in my MSSQL db called tbl_FULL which contains a full description of the product along with html formatting for line breaks, paragraphs and special characters (ie •).
I have set the data type to varchar 1800. All seemed to be well until I tried to enter new data, but unfortunately it only displays the first 50 or so characters.
Hi, I am trying to do the conversion function (change from kb - mb-gb) in sql and this is the function i wrote. when i give dbo.conversion (1234567) it works but when i give dbo.conversion (123456789432) it says "Arithmetic overflow error converting expression to data type int."
what could be the problem. any help ??
CREATE FUNCTION conversion(@Number1 Decimal(30,2)) RETURNS Decimal(30,2) BEGIN DECLARE @Result Decimal(30,2) IF @Number1 < 1024 SET @Result = @Number1 IF @Number1 >= 1024 and @Number1 < (1024*1024) SET @Result = cast((@Number1/1024.0) as decimal(30,2)) IF @Number1 >= (1024*1024) and @Number1 < (1024*1024*1024) SET @Result = cast((@Number1/(1024.0*1024)) as decimal(30,2)) IF @Number1 >= (1024*1024*1024) and @Number1 < (1024*1024*1024*1024) SET @Result = cast((@Number1/(1024.0*1024*1024)) as decimal(30,2)) RETURN @Result END
I'm creating a checksum column in a table that is to be calculated over several columns within the table.
One of the columns to be included in the checksum formula has a data type ntext.
But on trying to complete this new table design (or similarly using alter table in QA) - both return an error stating that the data type is invalid for the checksum function.
This happens for both ntext and text data types.
Can anyone tell me if there is a way round this without having to change the data type - or the valid data types that can be used for the checksum funciton?