Confusion With SQL Server Database Data Types
Jan 17, 2007
I trust you'll bear with an SQL Server newbie with what may seem a rather inane request. I am designing a web app in Web Designer 2005 Express with SQL Server Express. Unfortunately, I'm finding a little confusing with some of the data types when designing tables. I have tried to find information on the various Microsoft sites (general site, MSDN, here) and while I found one document that had a table comparing data types in different implementations of SQL, it wasn't at all helpful. Most of my confusion is with the various string and char types; the numeric types seem pretty straight forward for the most part. However, it might be helpful to know the difference between money and smallmoney/datetime and smalldatetime, particularly space/size information and formatting options (unless the latter is up to the interface). It would also be helpful to know which string/char types correspond to any counterparts they might have in, for instance, Access (with which I am already quite exprienced). Or any particular quirks or idiosyncracies they might have. I don't expect anyone to write a full tutorial, but if someone could point me in the direction of a good online doc, it would be most appreciated. You might well ask, why not use Access databases? I would answer...I like to learn new stuff!
Thanks much.
View 4 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
May 19, 2008
Hello All,i have a sql database with a table as follows. CustID (PK, Varchar(50) not null )Address ( VarChar(max), null)City ( VarChar(max), null)State( VarChar(max), null)Zip ( VarChar(5), null) ----------------------------- this is not working cuts off the leading zero like ( 01234) is shown as 1234DateShipped( datetime, null) --------------------- this display 05/18/2008 12:00AM. i just want to display (05/18/08).how can we do the above two. any suggestions please. i tried smalldatetime no luck . i appreciate it.Thanks.
View 3 Replies
View Related
Oct 24, 2007
i want to learn about the meanings of the different 'data types' in VS 2005 (database) i.e. 'nvarchar(50). could you please advice me of a good site (reference) to read.
View 1 Replies
View Related
Aug 22, 2006
Could someone help me with writing the code to export the contents of a varbinary field in my database to make the contents be written to the local harddrive? I can do this in Visual Foxpro but my company wants it in C# and I have no clue about C#.
Thank you:eek:
View 3 Replies
View Related
Jun 29, 2006
Hello All,I am stuck on a task that I need to complete. What I have is a SQL 2005DB running with a Table called Docs. The table structure consists ofthe following:Table Structure for Docs------------------------------------DocID int - Primary KeyClientID int - CustomerIDCreatedByUser nvarchar - UserNameCreatedDate datetime - Date of Document stored in SQL DBContent image - Bytes of actually documentContentType nvarchar - (application/msword)ContentTypeImage nvarchar - Path to Image of Document Type(such asword.gif")ContentSize int - Size of DocumentFriendlyName nvarchar - Name of DocumentWhat I want to do is create a query to export all documents from theSQL DB to a local folder on the server or even my local pc. Can this bedone?Thanks
View 1 Replies
View Related
Apr 8, 2008
I would like to create a table which can store a VLOB or BLOB.. which are pictures and images.. How do I insert them into the database and how do I select them into the data base for playing in a media player
I really do not have a background on this.. much.. I just know how to connect to a database and insert texts.. and updating and stuffs...
View 3 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
Oct 11, 2005
I'm new to SQL Server, but could someone explain how to set up a field with an auto number/increment that can be used within an Access DB?
View 4 Replies
View Related
Jan 13, 2004
I am trying to write a generic stored procedure to return the data type of a given col in a given table in any database.
I would like to place this sp in master.
input parms are @TableName sysname and @ColName sysname
ouput parm is @data_type varchar(128)
set @data_type=''
select @data_type = data_type from information_schema.columns where table_name = @TableName and column_name = @ColName
when debugging this I always get 0 rows (@data_type remains '')
I have a thought that I can add an input parm for the database, say @DbName sysname
But I am having trouble updating the select stmt to be something like
...from @DbName +'.' + information_schema.columns.
Any Ideas?
Thanks for your help.
View 9 Replies
View Related
May 25, 2006
Very simple ...
Where can I find a web site that explains the difference between sql server express data types?
thx.
View 3 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
Feb 2, 2006
Is there a way to change the default data type in SQL Server? If I import a database into SQL Server it makes every non-numeric field a nvarchar field. Is there a way to change this so that these fields would be varchar or char by default? I cannot find any way to redo these as a batch/group update and have to modify every single field manually. Any insights greatly appreciated.
View 4 Replies
View Related
Jan 24, 2005
Hi,
Can anybody give me some information on Table data types of SQL2K.
How and where can it be used. Does it make the queries faster, in case there are many users using ?
Please could anybody give me these details, to make me decide whether I can use it or not ?
Thanx and Regards,
Sushma
View 1 Replies
View Related
Jun 11, 2014
We have a query that joins column A int which is an int onto column B with contains only int's but was created as a varchar and can't be changed to an int at the moment.
Casting column a as a varchar in the ON of the join to left join seems to void the index altogether and the query just runs for every.
We are talking a few hundred million rows of data in each table.
Temp solution is select into a #Hash table as correct data type and index then use the #Hash table in the join.
View 6 Replies
View Related
Aug 14, 2006
I need to create a view of a sql table, but change the data types. I knowthe syntax below is not correct, and can't figure out if it is wrong or ifyou just can't do this. I have only created views before with the same datatype.CREATE VIEW F0005New(DRKY nchar(3), DRDL01 nchar(30))INSERT (SELECT rtrim(F0005.DRKY), F0005.DRDL01FROM F0005 AS F0005WHERE DRSY = '41' AND DRRT = 'S1')Thanks!!
View 4 Replies
View Related
Jul 20, 2005
Hi Can anyone point me to a document somewhere that shows a mapping ofSQL Server 2000 datatypes to C datatypes? I am writing some extendedstored procedures which need to be able to process pretty much anydata type, so I want to make sure I am taking them from SRVPROC andstoring them in the correct C data type.Thanks,Bruce
View 1 Replies
View Related
Jul 20, 2005
Hi,Can anybody tell me if it is possible to return a table data type (asopposed to a temporary table) from a stored procedure.I am currently studying for 70-229 using the Thomas Moore book but itdoesn't really make it clear, as the text suggests you can't returnthem but some of his sample questions suggest you can.I can't make it work in Query Analyser so I am assuming that you can'treturn them. Is that correct?Thanks in advance for any help,Simon.
View 1 Replies
View Related
Jul 20, 2005
Is there ANY data type other than varchar that is valid for localvariables and allows more than 8000 characters?
View 3 Replies
View Related
Jan 5, 2006
Hi,
I´m building an aplication with VB.net and SQL Server 9, but in the future it will be compatible with PostgreSQL (by another developer), so my question is, if anyone knows what "data types" in SQL Server 9 i must use to maintain compatibility with PostgreSQL, so that when the time come for the conversion i don t have to chage the "Data Types" on each table.
Any help would be apreciated.
View 4 Replies
View Related
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
Jul 12, 2007
Hi,
I need to populate some SqlParameter but I temporarily need to populate with a default value for the data type in question. Of course I can work them out, but I was wondering if there is already a way of doing this, from the .Net Classes or from SQL Server but without making a trip to the DB.
Thanks
John
View 1 Replies
View Related
Jan 8, 2004
i have created asp.net page, one feild of this page text area.
when i insert some text through this page in "text feild" of SQL server on few words of this feild cut and inserted to text feild of SQL server but all text that i have written in text area feild.
can u please help me how to handle so that i can all text in text feild of SQL server data type text/next.
View 2 Replies
View Related
Apr 4, 2006
I have a simple Integration Services project and the problem is that decimal fields are importing as real (I'm loosing the digits behind the decimal point).
The project contains a data flow task importing a flat file (.csv) to an SQL Server destination. My .csv file has two decimal type fields. Example:
Field 1: 12345.67
Field 2: .123456
My database table that I'm importing to has two fields. The only way that I can get this data to import is to define the fields as "float" in both the text file and database table. I want the database table fields to be defined as decimal or numeric, not float:
Field 1: decimal(7,2)
Field 2: decimal(6,6)
When all fields are defined as decimal (in both the flat file and database file), I get the following results:
Field 1: 12345.00
Field 2: .000000
How does one import decimal data from a flat file (.csv)?
Thank you in advance!
View 1 Replies
View Related
May 22, 2004
Which Datatype should i choose for Field "AGE"
Do i select "Int", "Char"?
SQL Server...in Table Desgin, The length for Int only can be max of 4 ?
Is this mean it can only store 4 digit ?
What if i want to store numbers but more then 4 digit ?
What will be the appropriate datatype to store numbers?
View 5 Replies
View Related
Oct 11, 2007
Hi everyone,
I have a question related to data flow task's block. Lets say i have a problem to solve that consist of 5 major transformation steps and each transformation step ends with a Result set, this result set of Step1 is required by Step2 and the Result set of step2 is required by 3 ....
now i can solve the the problem inside a single "data flow task" block but this is not my aim, since this is not clean aproach specially if the calculation and transformation requires a lof of task so since i would like to solve the problem in differnt block depending on the complexity and logic of the problem.
My Question is how can I pass Result set of a "data flow task" block from step a to the "data flow task" Block of Step B in the Controll flow view(tab) , i tried connecting both blocks as in the dataflow view(tab) by my connections does not show any metadata informations which mean the do not contains any afaik.
thanks in Advance
e. Yassine
View 11 Replies
View Related
Sep 26, 2007
I am working with a legacy SQL server database from SQL Server 2000. I noticed that in some places that they use decimal data types, that I would normally think they should be using integer data types. Why is this does anyone know?
Example: AutomobileTypeId (PK, decimal(10,0), not null)
View 5 Replies
View Related
Jun 15, 2004
I think I may have figured out the solution to my recent conundrum with SQL Server 2000 that had me stressed and depressed over the last couple of days. In a nutshell, after a HotFix was installed on a SQL2K database server I have space on, I was unable to perform INSERT or UPDATE queries on database table of type TEXT, when trying to either create or modify records with more than 4,000 characters of data. While it was frustrating as heck, it seemed too rigid to be random, so I did some snooping.
The HotFix was intended to solve a known problem of not being able to run UPDATEs against TEXT fields, but in so doing, caused another headache entirely: http://support.microsoft.com/?kbid=839523
Apparently this is a semi-known problem, in that a certain HotFix forces SQL Server 2000 to be a lot more stringent in requiring explicit declaration of data types and data lengths for parameters in stored procedure. In my client code, I was initially using the overloaded constructor of the SqlParameter object that took as arguments only the parameter name and a value, without specifying a value from the SQLDBType enumeration or length of the parameter (which in my case, needs to be TEXT and 16 (or 2147483647), respectively):
System.Data.SqlDataAdapter.InsertCommand.Parameters.Add(new SqlParameter("@parameterName",parameterValue);
It appears that after the HotFix is installed, if the client doesn’t syntactically set the type and length of data for a parameter, SQL Server and/or .NET will default to a type of NVARCHAR, which has the 4,000-character limit. This all makes sense. I’m going to now need to modify the code to straight out declare what’s going in the SPROC:
System.Data.SqlDataAdapter.InsertCommand.Parameters.Add(new SqlParameter("@parameterName",SqlDbType.Text);
System.Data.SqlDataAdapter.InsertCommand.Parameters["@parameterName"].Value = parameterValue;
It’s a minor change, and it sucks that I have to make it after the code had worked flawlessly over several thousands executions over several months, but c’est la vie! Better thay than have to rebuild my DB from scratch or switch to a new server. Changing the client code evidently is the only known fix at this time: http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b827366
View 1 Replies
View Related
Dec 2, 2005
I'm currently trying out transactional replication with updatable subscriptions across two 2005 servers.
View 3 Replies
View Related
Jul 20, 2005
HelloI am running a SP from the SQL Server Agent, the job has one step thatlooks like this.exec q_spr_inlevextsystemThis job fails with the following messageJob 'AutoInlev' : Step 1, 'Run the SP q_spr_inlevextsystem' : BeganExecuting 2004-04-05 09:00:00output---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(null)Starting copy...(null)1 rows copied.Network packet size (bytes): 4096Clock Time (ms.): total 1(null)(0 rows(s) affected)Msg 8152, Sev 16: String or binary data would be truncated. [SQLSTATE22001]Msg 3621, Sev 16: The statement has been terminated. [SQLSTATE 01000]however if I run that exact commandline from queryanalyzer it worksperfectly.What does SQL Server Agent do different from query analyzer? this hasme totally stumped.regardsMatt
View 5 Replies
View Related
Jul 13, 2006
Hello,
i'm quite confused from SQL Server 2005 security permission granting. Could you be so kind and post some generic, compact, web source for this topic, please?
Thank you.
View 3 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
May 29, 2007
caution: this is not doubt a stupid newbie question...
In creating vs.net 2005 website, I can add a sql database to my project and a mdf file is created. I can create data providers against this file, etc, just as though it were a database in a sql server instance. I can deploy this dbf file to my finished web site.
Also, I can attach to a running instance of sql server 2005 express, and do exactly the same thing.
I can also take my mdf file created in step 1 above, and attach it to a running instance of sql server express.
Now, I have delt with access databases, and sql server 2000 databases, so this dual nature of sql server 2005 express confuses me a little.
Why would I ever need to use a server instance of sql server 2005 when I can use a file based data file in my web apps? Is there an advantage to one or the other?
I had a thought that when using the file based method, I was actually still using the server based stuff, which would explain why the sql server express notification bubble pops up when I debug on the dev machine.
In any case could someone explain the difference and should I install sql server 2005 express on my deployment server?
thanks.
View 7 Replies
View Related