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...
thanksAny of the CHAR() related types, such as CHAR(), VARCHAR(), NCHAR(), NVARCHAR(), or TEXT should do nicely.
-PatP|||I have varchar now (on a web site with sql server as a database) but only save the letter and number for this example ab+ not the plus...
But I do have function, that I will probably have to customize,that is causing it only to save letters and numbers,
Thanks for your help once again
Showing posts with label characters. Show all posts
Showing posts with label characters. Show all posts
Friday, February 24, 2012
Sunday, February 19, 2012
Data Type question
Hi
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD
"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David
|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD
"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David
|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
Data Type question
Hi
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
Data Type question
Hi
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
>> Hi
>> I often have the dilemma of whether to use Text type or Varchar type.
>> Normally the situation is that the user will input 50 characters however
>> in some cases he will input 2000 characters should I make the field Text
>> or Varchar(2000)
>> Technically the question is whether a varchar field is assigned the space
>> automatically or only on request also how significant is the overhead of
>> using the Text type
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
I often have the dilemma of whether to use Text type or Varchar type.
Normally the situation is that the user will input 50 characters however in
some cases he will input 2000 characters should I make the field Text or
Varchar(2000)
Technically the question is whether a varchar field is assigned the space
automatically or only on request also how significant is the overhead of
using the Text type
Thank you in advance,
Shmuel Shulman
SBS Technologies LTD"S Shulman" <smshulman@.hotmail.com> wrote in message
news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
> Hi
> I often have the dilemma of whether to use Text type or Varchar type.
> Normally the situation is that the user will input 50 characters however
> in some cases he will input 2000 characters should I make the field Text
> or Varchar(2000)
> Technically the question is whether a varchar field is assigned the space
> automatically or only on request also how significant is the overhead of
> using the Text type
>
The "var" in varchar is because the storage is variable. It only takes up
as much space as you use (plus a small fixed overhead).
Using the text type causes a 16-byte locator to be stored in the row instead
of the actual value. The actual value is stored on another page. So the
overhead of using Text is mainly the extra read required to get to the
actual value. For 50-2000 characters, use Varchar.
David|||Thanks you for your response,
Shmuel
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e7rPgN0nFHA.3540@.TK2MSFTNGP10.phx.gbl...
> "S Shulman" <smshulman@.hotmail.com> wrote in message
> news:%23vJQVG0nFHA.3380@.TK2MSFTNGP12.phx.gbl...
>> Hi
>> I often have the dilemma of whether to use Text type or Varchar type.
>> Normally the situation is that the user will input 50 characters however
>> in some cases he will input 2000 characters should I make the field Text
>> or Varchar(2000)
>> Technically the question is whether a varchar field is assigned the space
>> automatically or only on request also how significant is the overhead of
>> using the Text type
> The "var" in varchar is because the storage is variable. It only takes up
> as much space as you use (plus a small fixed overhead).
> Using the text type causes a 16-byte locator to be stored in the row
> instead of the actual value. The actual value is stored on another page.
> So the overhead of using Text is mainly the extra read required to get to
> the actual value. For 50-2000 characters, use Varchar.
> David
>
data type for 32-bit
I am going to generate 32-bit encryption key with combination of any
number of characters. what data type and its size should I use for
that on MS SQL 2005? will it be nvarchar(max) or nvarchar(4000)
appropriate to use? thanks!You can use BINARY(4) if the key is always 32-bit. If it will vary then
maybe VARBINARY(4) will be better.
number of characters. what data type and its size should I use for
that on MS SQL 2005? will it be nvarchar(max) or nvarchar(4000)
appropriate to use? thanks!You can use BINARY(4) if the key is always 32-bit. If it will vary then
maybe VARBINARY(4) will be better.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Tuesday, February 14, 2012
Data Type
I am using a data type of varchar with a size of 5000. Why can I only
fit 1023 characters in the field?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Dinesh,
I am viewing the data through Enterprise Manager. I am
cutting and pasting data from a word document into the
varchar field that I set to 5000. Only 1023 characters
will fit. Why is that?
How can I use Query Analyzer to add data? I didn't know
you could do that other than using stored procedures or
insert queries.
>--Original Message--
>John,
>We need more details.How are you 'viewing' the data?If
through Query
>analyzer, make sure to increase the number in Tools menu
| options and
>'results' tab.You can always check the length of the
record in the table by
>using :
>SELECT length = DATALENGTH(<columnname>)
>FROM dbo.<tablename>
>Also, note that if you are inserting the data via
enterprise manager, it
>has this restriction.Always use Query Analyzer for
editing purposes.
>--
>Dinesh.
>SQL Server FAQ at
>http://www.tkdinesh.com
>"John Peters" <web_2@.yahoo.com> wrote in message
>news:%23wyDaYDXDHA.888@.TK2MSFTNGP10.phx.gbl...
>> I am using a data type of varchar with a size of
5000. Why can I only
>> fit 1023 characters in the field?
>> *** Sent via Developersdex
http://www.developersdex.com ***
>> Don't just participate in USENET...get rewarded for it!
>
>.
>|||John,
>>Why is that?
Thats a limitation with enterprise manager.
>>How can I use Query Analyzer to add data?
I meant use Query Analyzer(QA) to execute the INSERT (INTO) command to
insert data to a table.For example, execute the below script in QA:
SET NOCOUNT ON
--Checking if the table already exists.If so, drop it.
IF OBJECT_ID('dtatruntest','u') IS NOT NULL
DROP TABLE dtatruntest
GO
--Creating the table.
CREATE TABLE dtatruntest
(
dte VARCHAR(5000)
)
GO
--Inserting a row of length 5000
INSERT dbo.dtatruntest VALUES(REPLICATE('a',5000))
GO
--Checking if the entire row got inserted.
SELECT length = DATALENGTH(dte)FROM dbo.dtatruntest
GO
--selecting the row after making sure that the results number is
--increased in QA.
SELECT * FROM dbo.dtatruntest
GO
SET NOCOUNT OFF
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"John Peters" <web@.email.com> wrote in message
news:005101c35d01$c9814ab0$a401280a@.phx.gbl...
> Dinesh,
> I am viewing the data through Enterprise Manager. I am
> cutting and pasting data from a word document into the
> varchar field that I set to 5000. Only 1023 characters
> will fit. Why is that?
> How can I use Query Analyzer to add data? I didn't know
> you could do that other than using stored procedures or
> insert queries.
> >--Original Message--
> >John,
> >
> >We need more details.How are you 'viewing' the data?If
> through Query
> >analyzer, make sure to increase the number in Tools menu
> | options and
> >'results' tab.You can always check the length of the
> record in the table by
> >using :
> >
> >SELECT length = DATALENGTH(<columnname>)
> >FROM dbo.<tablename>
> >
> >Also, note that if you are inserting the data via
> enterprise manager, it
> >has this restriction.Always use Query Analyzer for
> editing purposes.
> >
> >--
> >Dinesh.
> >SQL Server FAQ at
> >http://www.tkdinesh.com
> >
> >"John Peters" <web_2@.yahoo.com> wrote in message
> >news:%23wyDaYDXDHA.888@.TK2MSFTNGP10.phx.gbl...
> >> I am using a data type of varchar with a size of
> 5000. Why can I only
> >> fit 1023 characters in the field?
> >>
> >> *** Sent via Developersdex
> http://www.developersdex.com ***
> >> Don't just participate in USENET...get rewarded for it!
> >
> >
> >.
> >
fit 1023 characters in the field?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Dinesh,
I am viewing the data through Enterprise Manager. I am
cutting and pasting data from a word document into the
varchar field that I set to 5000. Only 1023 characters
will fit. Why is that?
How can I use Query Analyzer to add data? I didn't know
you could do that other than using stored procedures or
insert queries.
>--Original Message--
>John,
>We need more details.How are you 'viewing' the data?If
through Query
>analyzer, make sure to increase the number in Tools menu
| options and
>'results' tab.You can always check the length of the
record in the table by
>using :
>SELECT length = DATALENGTH(<columnname>)
>FROM dbo.<tablename>
>Also, note that if you are inserting the data via
enterprise manager, it
>has this restriction.Always use Query Analyzer for
editing purposes.
>--
>Dinesh.
>SQL Server FAQ at
>http://www.tkdinesh.com
>"John Peters" <web_2@.yahoo.com> wrote in message
>news:%23wyDaYDXDHA.888@.TK2MSFTNGP10.phx.gbl...
>> I am using a data type of varchar with a size of
5000. Why can I only
>> fit 1023 characters in the field?
>> *** Sent via Developersdex
http://www.developersdex.com ***
>> Don't just participate in USENET...get rewarded for it!
>
>.
>|||John,
>>Why is that?
Thats a limitation with enterprise manager.
>>How can I use Query Analyzer to add data?
I meant use Query Analyzer(QA) to execute the INSERT (INTO) command to
insert data to a table.For example, execute the below script in QA:
SET NOCOUNT ON
--Checking if the table already exists.If so, drop it.
IF OBJECT_ID('dtatruntest','u') IS NOT NULL
DROP TABLE dtatruntest
GO
--Creating the table.
CREATE TABLE dtatruntest
(
dte VARCHAR(5000)
)
GO
--Inserting a row of length 5000
INSERT dbo.dtatruntest VALUES(REPLICATE('a',5000))
GO
--Checking if the entire row got inserted.
SELECT length = DATALENGTH(dte)FROM dbo.dtatruntest
GO
--selecting the row after making sure that the results number is
--increased in QA.
SELECT * FROM dbo.dtatruntest
GO
SET NOCOUNT OFF
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"John Peters" <web@.email.com> wrote in message
news:005101c35d01$c9814ab0$a401280a@.phx.gbl...
> Dinesh,
> I am viewing the data through Enterprise Manager. I am
> cutting and pasting data from a word document into the
> varchar field that I set to 5000. Only 1023 characters
> will fit. Why is that?
> How can I use Query Analyzer to add data? I didn't know
> you could do that other than using stored procedures or
> insert queries.
> >--Original Message--
> >John,
> >
> >We need more details.How are you 'viewing' the data?If
> through Query
> >analyzer, make sure to increase the number in Tools menu
> | options and
> >'results' tab.You can always check the length of the
> record in the table by
> >using :
> >
> >SELECT length = DATALENGTH(<columnname>)
> >FROM dbo.<tablename>
> >
> >Also, note that if you are inserting the data via
> enterprise manager, it
> >has this restriction.Always use Query Analyzer for
> editing purposes.
> >
> >--
> >Dinesh.
> >SQL Server FAQ at
> >http://www.tkdinesh.com
> >
> >"John Peters" <web_2@.yahoo.com> wrote in message
> >news:%23wyDaYDXDHA.888@.TK2MSFTNGP10.phx.gbl...
> >> I am using a data type of varchar with a size of
> 5000. Why can I only
> >> fit 1023 characters in the field?
> >>
> >> *** Sent via Developersdex
> http://www.developersdex.com ***
> >> Don't just participate in USENET...get rewarded for it!
> >
> >
> >.
> >
Subscribe to:
Posts (Atom)