Sunday, February 19, 2012
bytes used by datatypes
int,datetime,money,bit,varchar consume ?
Thanks
Check BOL
Books Online...
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Hassan" wrote:
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>
>
|||Check SQL Server Books Online
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
"Hassan" <Hassan@.hotmail.com> wrote in message
news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>
|||Look at Data Types in books online
Regards
Amish shah
Jack Vamvas wrote:
[vbcol=seagreen]
> Check SQL Server Books Online
> --
> Jack Vamvas
> ___________________________________
> Receive free SQL tips - www.ciquery.com/sqlserver.htm
> "Hassan" <Hassan@.hotmail.com> wrote in message
> news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
bytes used by datatypes
int,datetime,money,bit,varchar consume ?
ThanksCheck BOL
Books Online...
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and
time
asking back if its 2000 or 2005]
"Hassan" wrote:
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>
>|||Check SQL Server Books Online
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
"Hassan" <Hassan@.hotmail.com> wrote in message
news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>|||Look at Data Types in books online
Regards
Amish shah
Jack Vamvas wrote:
[vbcol=seagreen]
> Check SQL Server Books Online
> --
> Jack Vamvas
> ___________________________________
> Receive free SQL tips - www.ciquery.com/sqlserver.htm
> "Hassan" <Hassan@.hotmail.com> wrote in message
> news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
bytes used by datatypes
int,datetime,money,bit,varchar consume ?
ThanksCheck BOL
Books Online...
--
Thanks,
Sree
[Please specify the version of Sql Server as we can save one thread and time
asking back if its 2000 or 2005]
"Hassan" wrote:
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>
>|||Check SQL Server Books Online
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
"Hassan" <Hassan@.hotmail.com> wrote in message
news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
> Where can i find how much bytes datatypes such as
> int,datetime,money,bit,varchar consume ?
> Thanks
>|||Look at Data Types in books online
Regards
Amish shah
Jack Vamvas wrote:
> Check SQL Server Books Online
> --
> Jack Vamvas
> ___________________________________
> Receive free SQL tips - www.ciquery.com/sqlserver.htm
> "Hassan" <Hassan@.hotmail.com> wrote in message
> news:u9T5xLLQGHA.3192@.TK2MSFTNGP09.phx.gbl...
> > Where can i find how much bytes datatypes such as
> > int,datetime,money,bit,varchar consume ?
> >
> > Thanks
> >
> >
Tuesday, February 14, 2012
But the documentation is NOT correct
ISNUMERIC returns 1 when the input expression evaluates to a valid
integer, floating point number, money or decimal type; otherwise it
returns 0. A return value of 1 guarantees that expression can be
converted to one of these numeric types.
(Cut and pasted from books online)
Yet the following, one of many, example shows this is not true.
select isnumeric(char(9))
select convert(int, char(9))
----
1
(1 row(s) affected)
Server: Msg 245, Level 16, State 1, Line 2
Syntax error converting the varchar value '' to a column of data type
int.
So, besides filtering every possible invalid character, how do you
convert dirty values without error. I am not concerned that I may loose
possibly valid values or convert suspect strings to 0 (zero). I just
want to run without raising an errorBooks Online is quite correct here, it just could be a bit clearer. The
significant word in the paragraph you posted is "or". ISNUMERIC returns
1 if the data is convertible to ANY of the datatypes listed. Try the
following, which will work:
SELECT CONVERT(MONEY, CHAR(9))
If you just want to convert positive integers then you can use LIKE to
determine whether a string contains only numerics:
SELECT CAST(col AS INTEGER)
FROM YourTable
WHERE col NOT LIKE '%[^0-9]%'
--
David Portas
SQL Server MVP
--|||By inference then CONVERT(MONEY, x) is the most 'tolerant' conversion.
Strings containing only numerics is also elegant.
Thanks for the tip|||(bilbo.baggins@.freesurf.ch) writes:
> By inference then CONVERT(MONEY, x) is the most 'tolerant' conversion.
Not necessarily:
SELECT convert(money, '1E1')
bombs. But isnumeric() returns 1.
isnumeric is a useless function.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp