Showing posts with label datatype. Show all posts
Showing posts with label datatype. Show all posts

Friday, February 24, 2012

Data validation for datetime parameter in SSRS

Hi,

I wanted to know more about validation of SSRS parameters. I have a simple report which has a parameter called startdate of DateTime datatype. The datetime parameter in SSRS takes manual input as well. So, the user can enter any junk value. I want to ensure that the input parameter is in correct format and I want to display an error msg when the format is incorrect. My report has the following VB code for validation:

Public Function Validate( ByVal startdate As String) As Boolean
If IsDate(startdate) = True Then
Return True
Else
Return False
End If
End Function

And my report has a textbox which has the expression property set to;

=Code.Validate(Parameters!startdate.Value)

the textbox on the report has to display if the entered date is valid or not.

But, when i enter an erroneous date, SSRS doesn't render the report and throws a generic error. This happens even before the code written for validating the parameter executes.

Also couldn't find a way to disable the manual input for the datetime parameter. Even that would solve the problem.

Another alternative was to make the startdate parameter as string, but i want the calendar control button to be provided for the user.

The function below checks for the Start and End date ranges .

Function:

Function CheckDateParameters(StartDate as Date, EndDate as Date) as Integer
Dim msg as String
msg = ""
If (StartDate > EndDate) Then
msg="Start Date should not be later than End Date"
End If
If msg <> "" Then
MsgBox(msg, 16, "Report Validation")
Err.Raise(6,Report) 'Raise an overflow
End If
End Function

Steps:

1.) Go the Report Parameters and add a parameter with the datatype is string.

2.) Check the Hidden checkbox and Allow blank value ckeckbox.

3.) From Default Values choose Non-Queried radio button and then press the FX button and paste this code.

=CODE.CheckDateParameters(<parameterStartdate>.Value,<parameterEnddate>.Value)

Then press OK.

Hope this helps......|||

In the sample that you provided, if we enter an improper date as 02/31/2003 [mm/dd/yyyy], then the report execution fails and an error is thrown right away "error occured during the processing of report parameter". I was talking of handling such errors.

I feel that reporting services, initially validates the entered value matches the datatype of the parameter and then proceeds with execution of any VB code and finally renders the report.

When I said validation, I wanted a functionality similar to the client side validation in an asp page, where improper date formats like 12/31/235668 etc can be taken care of.

Data types

Hi everyone,
Which is better to use for datatypes nvarchar or varchar?
In access it is a text datatype. For instance i use in access an column with
datatype text, length 100. When upsizing sql server convert this into
nvarchar(100).
Should i leave it this way or is it better to change it to a suitable
datatype.nvarchar uses twice the storage space but allows for storage of more
characters / symbols to support various languages.
If your access db is in a non enlgish language, it's likely best for you to
use nvarchar.
Regards,
Greg Linwood
SQL Server MVP
"Ezekiël" <ezekiel@.lycos.nl> wrote in message
news:eUnabfTyDHA.1996@.TK2MSFTNGP12.phx.gbl...
> Hi everyone,
> Which is better to use for datatypes nvarchar or varchar?
> In access it is a text datatype. For instance i use in access an column
with
> datatype text, length 100. When upsizing sql server convert this into
> nvarchar(100).
> Should i leave it this way or is it better to change it to a suitable
> datatype.
>|||nvarchar can handle unicode characters
varchar cannot
if you need to deal with these characters for example
french and spanish have accent marks and these are fairly
common within people names and place names, then you need
nvarchar. The downside is that it is twice as large (in
storage terms) as varchar because each character required
two bytes, varchar characters require 1 byte.
regards & Merry Christmas,
Mark Baekdal
www.dbghost.com
>--Original Message--
>Hi everyone,
>Which is better to use for datatypes nvarchar or varchar?
>In access it is a text datatype. For instance i use in
access an column with
>datatype text, length 100. When upsizing sql server
convert this into
>nvarchar(100).
>Should i leave it this way or is it better to change it
to a suitable
>datatype.
>
>.
>|||Hi Mark,
Thx for the explaination. Does the performance sql server decreases if
diskspace is not a problem or does sql not work that way?
"mark baekdal" <anonymous@.discussions.microsoft.com> wrote in message
news:07da01c3c941$52d93650$a301280a@.phx.gbl...
> nvarchar can handle unicode characters
> varchar cannot
> if you need to deal with these characters for example
> french and spanish have accent marks and these are fairly
> common within people names and place names, then you need
> nvarchar. The downside is that it is twice as large (in
> storage terms) as varchar because each character required
> two bytes, varchar characters require 1 byte.
> regards & Merry Christmas,
> Mark Baekdal
> www.dbghost.com
> >--Original Message--
> >Hi everyone,
> >
> >Which is better to use for datatypes nvarchar or varchar?
> >In access it is a text datatype. For instance i use in
> access an column with
> >datatype text, length 100. When upsizing sql server
> convert this into
> >nvarchar(100).
> >
> >Should i leave it this way or is it better to change it
> to a suitable
> >datatype.
> >
> >
> >.
> >|||Performance will decrease... The reason is that rows may be twice as long,
therefore half as many rows will fit on a page... This means,
1. Twice as much IO is required to get the same number of rows
2. The rows take up twice as much space in memory, which means OTHER data
gets bumped out of memory, which means OTHER folks have to do more IO as
well..
Use Nvarchar IF you need to store information in ANY language, But if you
only need to store data in latin based languages,,, varchar would be better.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Ezekiël" <ezekiel@.lycos.nl> wrote in message
news:eUnabfTyDHA.1996@.TK2MSFTNGP12.phx.gbl...
> Hi everyone,
> Which is better to use for datatypes nvarchar or varchar?
> In access it is a text datatype. For instance i use in access an column
with
> datatype text, length 100. When upsizing sql server convert this into
> nvarchar(100).
> Should i leave it this way or is it better to change it to a suitable
> datatype.
>|||Usually you will have a slight decrease in performance
using nvarchar although this should be neglible.
regards,
Mark Baekdal
www.dbghost.com
>--Original Message--
>Hi Mark,
>Thx for the explaination. Does the performance sql
server decreases if
>diskspace is not a problem or does sql not work that way?
>"mark baekdal" <anonymous@.discussions.microsoft.com>
wrote in message
>news:07da01c3c941$52d93650$a301280a@.phx.gbl...
>> nvarchar can handle unicode characters
>> varchar cannot
>> if you need to deal with these characters for example
>> french and spanish have accent marks and these are
fairly
>> common within people names and place names, then you
need
>> nvarchar. The downside is that it is twice as large (in
>> storage terms) as varchar because each character
required
>> two bytes, varchar characters require 1 byte.
>> regards & Merry Christmas,
>> Mark Baekdal
>> www.dbghost.com
>> >--Original Message--
>> >Hi everyone,
>> >
>> >Which is better to use for datatypes nvarchar or
varchar?
>> >In access it is a text datatype. For instance i use in
>> access an column with
>> >datatype text, length 100. When upsizing sql server
>> convert this into
>> >nvarchar(100).
>> >
>> >Should i leave it this way or is it better to change
it
>> to a suitable
>> >datatype.
>> >
>> >
>> >.
>> >
>
>.
>

Data Types

Hello, Is there any document that tells you the pro/cons for using one data
type over another? I just recently upgraded from Access to SQL Server 2000.
I used the Access upgrade wizard and was wondering how it determines when to
assign types to ntext or text. Also, if the character in the text field are
less than 2000 should I convert this field to say varchar(2000) or
nvarchar(2000)?
Thanks
DonIf you need unicode then nvarchar else varchar.
Don't use text unles the field could go over 8000 chars (4000 for nvarchar).
Always review what the upgrade wizard has done - it makes all text fields nv
archar I think which is not good.
It's usually a good time to review the database design.
"Don" wrote:

> Hello, Is there any document that tells you the pro/cons for using one dat
a
> type over another? I just recently upgraded from Access to SQL Server 200
0.
> I used the Access upgrade wizard and was wondering how it determines when
to
> assign types to ntext or text. Also, if the character in the text field a
re
> less than 2000 should I convert this field to say varchar(2000) or
> nvarchar(2000)?
> Thanks
> Don
>
>|||As Nigel says, review the actual needs, because the upgrade wizard seems to
choose large datatypes... If a tinyint will do , do not use an int or
smallint...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Don" <dons100@.ameritech.net> wrote in message
news:lCkDc.1791$kK4.474@.newssvr16.news.prodigy.com...
> Hello, Is there any document that tells you the pro/cons for using one
data
> type over another? I just recently upgraded from Access to SQL Server
2000.
> I used the Access upgrade wizard and was wondering how it determines when
to
> assign types to ntext or text. Also, if the character in the text field
are
> less than 2000 should I convert this field to say varchar(2000) or
> nvarchar(2000)?
> Thanks
> Don
>

Data Types

Hello, Is there any document that tells you the pro/cons for using one data
type over another? I just recently upgraded from Access to SQL Server 2000.
I used the Access upgrade wizard and was wondering how it determines when to
assign types to ntext or text. Also, if the character in the text field are
less than 2000 should I convert this field to say varchar(2000) or
nvarchar(2000)?
Thanks
Don
If you need unicode then nvarchar else varchar.
Don't use text unles the field could go over 8000 chars (4000 for nvarchar).
Always review what the upgrade wizard has done - it makes all text fields nvarchar I think which is not good.
It's usually a good time to review the database design.
"Don" wrote:

> Hello, Is there any document that tells you the pro/cons for using one data
> type over another? I just recently upgraded from Access to SQL Server 2000.
> I used the Access upgrade wizard and was wondering how it determines when to
> assign types to ntext or text. Also, if the character in the text field are
> less than 2000 should I convert this field to say varchar(2000) or
> nvarchar(2000)?
> Thanks
> Don
>
>
|||As Nigel says, review the actual needs, because the upgrade wizard seems to
choose large datatypes... If a tinyint will do , do not use an int or
smallint...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Don" <dons100@.ameritech.net> wrote in message
news:lCkDc.1791$kK4.474@.newssvr16.news.prodigy.com ...
> Hello, Is there any document that tells you the pro/cons for using one
data
> type over another? I just recently upgraded from Access to SQL Server
2000.
> I used the Access upgrade wizard and was wondering how it determines when
to
> assign types to ntext or text. Also, if the character in the text field
are
> less than 2000 should I convert this field to say varchar(2000) or
> nvarchar(2000)?
> Thanks
> Don
>
|||As Nigel says, review the actual needs, because the upgrade wizard seems to
choose large datatypes... If a tinyint will do , do not use an int or
smallint...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Don" <dons100@.ameritech.net> wrote in message
news:lCkDc.1791$kK4.474@.newssvr16.news.prodigy.com ...
> Hello, Is there any document that tells you the pro/cons for using one
data
> type over another? I just recently upgraded from Access to SQL Server
2000.
> I used the Access upgrade wizard and was wondering how it determines when
to
> assign types to ntext or text. Also, if the character in the text field
are
> less than 2000 should I convert this field to say varchar(2000) or
> nvarchar(2000)?
> Thanks
> Don
>

data type to store time

Hi all ,

What datatype should I take to store time in a table -- datetime , float or decimal?

my requirement is to store "Worked Hours in a day by an employee" in the field say, 9 hrs and 30 mins.

I should be able to manipulate data in this field such as total hours present in the month, extra hours worked in a day (considering 9 hrs as standard time),less hours worked in a day, and so on

I would suggest the builtin DATETIME datatype. The advantage of this datatype is that it gives you the ability to directly use the builtin functions that come with TSQL.|||

As Kent indicated, using a datetime is most likely the best option. Yes, it will put the default date of Jan 1st, 1900, but you are interested in the hours.

You will be able to use datetime math functions, AND you don't have to remember to convert 20 minutes to .333333 hr, etc.

IF you are not concerned with seconds and milliseconds, you might consider a smalldatetime datatype.

|||Thanks Kent and Arnie for the quick response. I 'm new to this forum and sql server. Hope many more responses from you guys Smile

Data type to store photo

hello,

I want to store the photo in the sql server 2005 , what datatype should I use?

Moving to SQL Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=158&SiteID=1

Answer: VarBinary(MAX)

|||

Hi Amit,

You can use the datatype to store the images or data in DATABASE but it is not advisable, best practise says that it is better to store only path of the images or documents and let it play with front end application here is a Research paper availble prepared by ussell Sears; Catharine Van Ingen; Jim Gray http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45

HTH

Hemantgiri S. Goswami

|||but wht about replacement or file movement /deletion of the file ...the system /application will crash immediately....

Data type to store photo

hello,

I want to store the photo in the sql server 2005 , what datatype should I use?

Moving to SQL Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=158&SiteID=1

Answer: VarBinary(MAX)

|||

Hi Amit,

You can use the datatype to store the images or data in DATABASE but it is not advisable, best practise says that it is better to store only path of the images or documents and let it play with front end application here is a Research paper availble prepared by ussell Sears; Catharine Van Ingen; Jim Gray http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45

HTH

Hemantgiri S. Goswami

|||but wht about replacement or file movement /deletion of the file ...the system /application will crash immediately....

Data type to store photo

hello,

I want to store the photo in the sql server 2005 , what datatype should I use?

Moving to SQL Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=158&SiteID=1

Answer: VarBinary(MAX)

|||

Hi Amit,

You can use the datatype to store the images or data in DATABASE but it is not advisable, best practise says that it is better to store only path of the images or documents and let it play with front end application here is a Research paper availble prepared by ussell Sears; Catharine Van Ingen; Jim Gray http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2006-45

HTH

Hemantgiri S. Goswami

|||but wht about replacement or file movement /deletion of the file ...the system /application will crash immediately....
|||

Hi Amit,

The deletion/file movement can be handle through front end application.

Sunday, February 19, 2012

Data Type in Oracle is not translating in SSIS datatype

My OLDB data source in the Lookup Transformation is not converting

When I try to join the colunms it claims the data types do not match the only differnece is the percision.?

ORACLE
select CAST(group_id AS NUMBER(18)) group_id from blah blah table
SSIS data type = [DT_NUMERIC], Percision = 38

SQL Sever data source
SELECT
CAST(PRINCIPAL_ID as numeric) GROUP_ID,
SSIS data type = [DT_NUMERIC], Percision = 18The metadata of the columns being joined should have to match exactly. (same precision, same

scale)

data type for sound

hi .. what datatype should i use for sound clip in sqlserver?

To store binary data of arbitrary length in SQL Server 2005, use a data type of varbinary(max).

Friday, February 17, 2012

Data type conversions

What are the pros/cons of datatype conversions using the advanced properties of the source adapters or transformation components themselves vs. using the data conversion transformation? Sometimes I am able to do all the conversions I need using the advanced properties rather than use a data conversion component, but didn't know if this was considered bad practice, or has some other impact that isn't immediately apparent.

Thanks

Kory

I offten use Derived Column component as data conversion

I think that is well used to convert lots of data type at the same time

|||

I'd say doing as much conversion up front in a source as possible would be preferable. Doing it later on means you have a wider buffer, to accomodate the two columns required. Saying that, they can be harder to maintain sometimes, as refreshing the metadata can loose your little tweaks. Depends on how stable you view your source perhaps.

Using one transformation over another, Derived Column or Data Conversion would not seem like much of a choice really, I doubt there is much to choose between. They are both synchronous transforms, so will require two "columns" in the buffer, the current type and the new type. That obviously makes for a wider buffer and therefore more cost, due to less rows per buffer.

Still do what works for you, but test a few scenarios if you can and see which works best for you. If performance or maintanece a bigger cost to you?

Data type conversion .. Varchar to GUID

Hi,

I have a parameter @.name varchar(50)

but the table has a field with datatype GUID

how I can convert varchar to guid before insertion...

Thanks

As long as the format of the guid is correct, it should be no problem:

create table test
(
columnName uniqueidentifier
)
go
declare @.guid varchar(50) --char(36) would be better
set @.guid = 'E5F61BB0-38BA-4116-841D-C7E5AAA137A2'

insert into test
select @.guid
go

select *
from test

columnName

E5F61BB0-38BA-4116-841D-C7E5AAA137A2

declare @.guid varchar(50) --char(36) would be better
--invalid guid format:
set @.guid = 'E5F61BB038BA4116841DC7E5AAA137A2'

--failure
insert into test
select @.guid

Msg 8169, Level 16, State 2, Line 6
Conversion failed when converting from a character string to uniqueidentifier.

Data Type Confusion...

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?For age, an appropriate data type would be 'int', you should however contemplate SmallDateTime if you need the full Date of Birth. An 'int' has a storage size of 4 bytes, hence 4, and can be of values from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647).

Numbers can be stored using different data types, depending on what they represent and will be used for. E.g, for money, you simply use the data type 'money'.

Below are all numerics available on MS Sql Server 2000

EXACT NUMERICS
============
Integers
-------
bigint = Integer (whole number) data from -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807).

int = Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647).

smallint = Integer data from 2^15 (-32,768) through 2^15 - 1 (32,767).

tinyint = Integer data from 0 through 255.
-------
bit
-------
bit = Integer data with either a 1 or 0 value.
-------
decimal and numeric
-------
decimal = Fixed precision and scale numeric data from -10^38 +1 through 10^38 –1.

numeric = Functionally equivalent to decimal.
-------
money and smallmoney
-------
money = Monetary data values from -2^63 (-922,337,203,685,477.5808) through 2^63 - 1 (+922,337,203,685,477.5807), with accuracy to a ten-thousandth of a monetary unit.

smallmoney = Monetary data values from -214,748.3648 through +214,748.3647, with accuracy to a ten-thousandth of a monetary unit.
-------
Approximate Numerics
-------
float = Floating precision number data from -1.79E + 308 through 1.79E + 308.

real = Floating precision number data from -3.40E + 38 through 3.40E + 38.|||Hie...

Thanks alot for the info...

I just realize the Length "4" for "int" doesn't meant the total number of 4 digit...?

But how bout the Datatype "Char" or "NvarChar", the length is the number of character is it?|||you can use tinyint for AGE|||:: you can use tinyint for AGE

If you do not expect the person to live longer than a century, yeah :-) .|||::But how bout the Datatype "Char" or "NvarChar", the length is the number of character is
::it?

This is documented in the - documentation, you know.

For char and varchar fields, this is indeed the number of chars you store / can store.

DATA TYPE (STRING)

HI EVERY ONE,
I want to use long datatype as a string, which has variable length and may
exceed (8000) character. in a stored procedure or function as a variable.
when i tried to use the datatype ( Text, or nText ) i was not able to create
a stored procedure which manipulate where i have the following error message:
"The text, ntext, and image data types are invalid for local variables."
Any suggestions please.
Thanks
Rami,
Hi
Unfortunately for a local variable you are limited. You may want to use
multiple variables or a table as an alternative.
John
"Rami" <Rami@.discussions.microsoft.com> wrote in message
news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
> HI EVERY ONE,
> I want to use long datatype as a string, which has variable length and may
> exceed (8000) character. in a stored procedure or function as a variable.
> when i tried to use the datatype ( Text, or nText ) i was not able to
> create
> a stored procedure which manipulate where i have the following error
> message:
> "The text, ntext, and image data types are invalid for local variables."
> Any suggestions please.
> Thanks
> Rami,
|||I Tried to use a table fields variable but u can not manipulate the field the
same way u manipulate usual string,
for example:
Create Table T1
(
value TEXT
)
the following statment will generate an error message:
Update T1 set value = value + 'any additional string'
could u provide me with better techniques.
"John Bell" wrote:

> Hi
> Unfortunately for a local variable you are limited. You may want to use
> multiple variables or a table as an alternative.
> John
> "Rami" <Rami@.discussions.microsoft.com> wrote in message
> news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
>
>
|||Hi
Unfortunately to read/write/update text you require specific functions For
UPDATETEXT see
http://msdn.microsoft.com/library/de...reate_4hk5.asp
Large string handing has improved in SQL Server 2005.
John
"Rami" <Rami@.discussions.microsoft.com> wrote in message
news:741BB23B-F83E-41B9-A1DA-A5C78FEE210C@.microsoft.com...[vbcol=seagreen]
>I Tried to use a table fields variable but u can not manipulate the field
>the
> same way u manipulate usual string,
> for example:
> Create Table T1
> (
> value TEXT
> )
> the following statment will generate an error message:
> Update T1 set value = value + 'any additional string'
> could u provide me with better techniques.
> "John Bell" wrote:
|||Thanks John,
Rami
"John Bell" wrote:

> Hi
> Unfortunately to read/write/update text you require specific functions For
> UPDATETEXT see
> http://msdn.microsoft.com/library/de...reate_4hk5.asp
> Large string handing has improved in SQL Server 2005.
> John
> "Rami" <Rami@.discussions.microsoft.com> wrote in message
> news:741BB23B-F83E-41B9-A1DA-A5C78FEE210C@.microsoft.com...
>
>

DATA TYPE (STRING)

HI EVERY ONE,
I want to use long datatype as a string, which has variable length and may
exceed (8000) character. in a stored procedure or function as a variable.
when i tried to use the datatype ( Text, or nText ) i was not able to create
a stored procedure which manipulate where i have the following error message:
"The text, ntext, and image data types are invalid for local variables."
Any suggestions please.
Thanks
Rami,Hi
Unfortunately for a local variable you are limited. You may want to use
multiple variables or a table as an alternative.
John
"Rami" <Rami@.discussions.microsoft.com> wrote in message
news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
> HI EVERY ONE,
> I want to use long datatype as a string, which has variable length and may
> exceed (8000) character. in a stored procedure or function as a variable.
> when i tried to use the datatype ( Text, or nText ) i was not able to
> create
> a stored procedure which manipulate where i have the following error
> message:
> "The text, ntext, and image data types are invalid for local variables."
> Any suggestions please.
> Thanks
> Rami,|||I Tried to use a table fields variable but u can not manipulate the field the
same way u manipulate usual string,
for example:
Create Table T1
(
value TEXT
)
the following statment will generate an error message:
Update T1 set value = value + 'any additional string'
could u provide me with better techniques.
"John Bell" wrote:
> Hi
> Unfortunately for a local variable you are limited. You may want to use
> multiple variables or a table as an alternative.
> John
> "Rami" <Rami@.discussions.microsoft.com> wrote in message
> news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
> > HI EVERY ONE,
> >
> > I want to use long datatype as a string, which has variable length and may
> > exceed (8000) character. in a stored procedure or function as a variable.
> >
> > when i tried to use the datatype ( Text, or nText ) i was not able to
> > create
> > a stored procedure which manipulate where i have the following error
> > message:
> >
> > "The text, ntext, and image data types are invalid for local variables."
> >
> > Any suggestions please.
> >
> > Thanks
> > Rami,
>
>|||Hi
Unfortunately to read/write/update text you require specific functions For
UPDATETEXT see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_create_4hk5.asp
Large string handing has improved in SQL Server 2005.
John
"Rami" <Rami@.discussions.microsoft.com> wrote in message
news:741BB23B-F83E-41B9-A1DA-A5C78FEE210C@.microsoft.com...
>I Tried to use a table fields variable but u can not manipulate the field
>the
> same way u manipulate usual string,
> for example:
> Create Table T1
> (
> value TEXT
> )
> the following statment will generate an error message:
> Update T1 set value = value + 'any additional string'
> could u provide me with better techniques.
> "John Bell" wrote:
>> Hi
>> Unfortunately for a local variable you are limited. You may want to use
>> multiple variables or a table as an alternative.
>> John
>> "Rami" <Rami@.discussions.microsoft.com> wrote in message
>> news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
>> > HI EVERY ONE,
>> >
>> > I want to use long datatype as a string, which has variable length and
>> > may
>> > exceed (8000) character. in a stored procedure or function as a
>> > variable.
>> >
>> > when i tried to use the datatype ( Text, or nText ) i was not able to
>> > create
>> > a stored procedure which manipulate where i have the following error
>> > message:
>> >
>> > "The text, ntext, and image data types are invalid for local
>> > variables."
>> >
>> > Any suggestions please.
>> >
>> > Thanks
>> > Rami,
>>|||Thanks John,
Rami
"John Bell" wrote:
> Hi
> Unfortunately to read/write/update text you require specific functions For
> UPDATETEXT see
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_create_4hk5.asp
> Large string handing has improved in SQL Server 2005.
> John
> "Rami" <Rami@.discussions.microsoft.com> wrote in message
> news:741BB23B-F83E-41B9-A1DA-A5C78FEE210C@.microsoft.com...
> >I Tried to use a table fields variable but u can not manipulate the field
> >the
> > same way u manipulate usual string,
> >
> > for example:
> >
> > Create Table T1
> > (
> > value TEXT
> > )
> >
> > the following statment will generate an error message:
> >
> > Update T1 set value = value + 'any additional string'
> >
> > could u provide me with better techniques.
> >
> > "John Bell" wrote:
> >
> >> Hi
> >>
> >> Unfortunately for a local variable you are limited. You may want to use
> >> multiple variables or a table as an alternative.
> >>
> >> John
> >>
> >> "Rami" <Rami@.discussions.microsoft.com> wrote in message
> >> news:76BAF46C-4699-45A0-AF1C-AABBA66C8841@.microsoft.com...
> >> > HI EVERY ONE,
> >> >
> >> > I want to use long datatype as a string, which has variable length and
> >> > may
> >> > exceed (8000) character. in a stored procedure or function as a
> >> > variable.
> >> >
> >> > when i tried to use the datatype ( Text, or nText ) i was not able to
> >> > create
> >> > a stored procedure which manipulate where i have the following error
> >> > message:
> >> >
> >> > "The text, ntext, and image data types are invalid for local
> >> > variables."
> >> >
> >> > Any suggestions please.
> >> >
> >> > Thanks
> >> > Rami,
> >>
> >>
> >>
>
>

Data Type

I am a SQL newbie! What is the correct datatype to use, if I want to record
a checkbox from a web form? Thanks,
DarrenScrappy (celtics@.lan-specialist.com) writes:
> I am a SQL newbie! What is the correct datatype to use, if I want to
> record a checkbox from a web form? Thanks,

The most natural type to use would be bit, which only can hold the values 0
or 1.

If you want to stick to standards, you may avoid this datatype since it
is propritary to SQL Server and Sybase (or at least so claims Joe Celko).
In such case a char(1) column with the values T/F ot Y/N could be an
alternative. Or a tinyint column with the values 0/1.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||"Erland Sommarskog" <sommar@.algonet.se> wrote in message news:Xns93ACF34D8F415Yazorman@.127.0.0.1...
> Scrappy (celtics@.lan-specialist.com) writes:
> > I am a SQL newbie! What is the correct datatype to use, if I want to
> > record a checkbox from a web form? Thanks,
> The most natural type to use would be bit, which only can hold the values 0
> or 1.
> If you want to stick to standards, you may avoid this datatype since it
> is propritary to SQL Server and Sybase (or at least so claims Joe Celko).

Hi Erland, actually, BIT, and the more general BIT(n), are defined in both
SQL:1992 and SQL:1999. I believe the difference is that the Standard
requires a bit string literal to be written like B'1'. Not sure if the integer
1 would be automatically cast to B'1' but seems reasonable.

Regards,
jag

> In such case a char(1) column with the values T/F ot Y/N could be an
> alternative. Or a tinyint column with the values 0/1.
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp|||>> the more general BIT(n), are defined in both SQL:1992 and SQL:1999 <<

Yes, and in the Standards, you treat them as if they were character
strings. The operations are bit string comparison, assignment, bit
concatenation operator, bit substring function, length, and position.
You do not have bit-wise operators like you do in T-SQL or assembly
language.

When you try to use them with a host languages, you get all kinds of
problems -- high end or low end bytes? Does 0 or 1 mean "TRUE"?

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!