Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Tuesday, March 27, 2012

Case statement Error

Hi,
I don't know what i am doing wrong here, I am always getting this error
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '>'.
When I am running the following query
SELECT title, price,
Budget = CASE price
WHEN price > 20.00 THEN 'Expensive'
WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
WHEN price < 10.00 THEN 'Inexpensive'
ELSE 'Unknown'
END
FROM titles
Could anyone put some light on it.
Thanks
J S"John Smith" <John@.nospam.yahoo.com> wrote in news:ebqEpwfOFHA.1500
@.TK2MSFTNGP09.phx.gbl:

> Hi,
> I don't know what i am doing wrong here, I am always getting this error
> Server: Msg 170, Level 15, State 1, Line 3
> Line 3: Incorrect syntax near '>'.
> When I am running the following query
> SELECT title, price,
> Budget = CASE price
> WHEN price > 20.00 THEN 'Expensive'
> WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
> WHEN price < 10.00 THEN 'Inexpensive'
> ELSE 'Unknown'
> END
> FROM titles
> Could anyone put some light on it.
> Thanks
> J S
>
>
Leave out the field name between the CASE and WHEN keywords.
Rumble
"Write something worth reading, or do something worth writing."
-- Benjamin Franklin|||There are two versions of Case Syntax, and you are "mixing" them...
Ver 1
Case <Expression>
When <ExpressionValue1> Then <OutValue1>
When <ExpressionValue2> Then <OutValue2>
When <ExpressionValue3> Then <OutValue3>
Else <ElseOutValue> End
Version 2
Case
When <BooleanExpression1> Then <OutValue1>
When <BooleanExpression2> Then <OutValue2>
When <BooleanExpression3> Then <OutValue3>
Else <ElseOutValue> End
So you need to eliminate the "price" right after the Case...
SELECT title, price,
Budget = CASE
WHEN price > 20.00 THEN 'Expensive'
WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
WHEN price < 10.00 THEN 'Inexpensive'
ELSE 'Unknown'
END
FROM titles
"John Smith" wrote:

> Hi,
> I don't know what i am doing wrong here, I am always getting this error
> Server: Msg 170, Level 15, State 1, Line 3
> Line 3: Incorrect syntax near '>'.
> When I am running the following query
> SELECT title, price,
> Budget = CASE price
> WHEN price > 20.00 THEN 'Expensive'
> WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
> WHEN price < 10.00 THEN 'Inexpensive'
> ELSE 'Unknown'
> END
> FROM titles
> Could anyone put some light on it.
> Thanks
> J S
>
>|||this should work:
SELECT title, price,
Budget = CASE --price <- removed
WHEN price > 20.00 THEN 'Expensive'
WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
WHEN price < 10.00 THEN 'Inexpensive'
ELSE 'Unknown'
END
FROM titles
dean
"John Smith" <John@.nospam.yahoo.com> wrote in message
news:ebqEpwfOFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I don't know what i am doing wrong here, I am always getting this error
> Server: Msg 170, Level 15, State 1, Line 3
> Line 3: Incorrect syntax near '>'.
> When I am running the following query
> SELECT title, price,
> Budget = CASE price
> WHEN price > 20.00 THEN 'Expensive'
> WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
> WHEN price < 10.00 THEN 'Inexpensive'
> ELSE 'Unknown'
> END
> FROM titles
> Could anyone put some light on it.
> Thanks
> J S
>|||Thanks a lot guys, it is working....
J S
"John Smith" <John@.nospam.yahoo.com> wrote in message
news:ebqEpwfOFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I don't know what i am doing wrong here, I am always getting this error
> Server: Msg 170, Level 15, State 1, Line 3
> Line 3: Incorrect syntax near '>'.
> When I am running the following query
> SELECT title, price,
> Budget = CASE price
> WHEN price > 20.00 THEN 'Expensive'
> WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
> WHEN price < 10.00 THEN 'Inexpensive'
> ELSE 'Unknown'
> END
> FROM titles
> Could anyone put some light on it.
> Thanks
> J S
>|||I removed price from CASE. This passed syntax check for me:
SELECT title, price,
Budget = CASE
WHEN price > 20.00 THEN 'Expensive'
WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'
WHEN price < 10.00 THEN 'Inexpensive'
ELSE 'Unknown'
END
FROM titles

Wednesday, March 7, 2012

carrier return + line feed in a varchar

Hi

how can I split a line into 2 lines in t-sql. etc
Set @.text1 = 'here's line one' + (carriere return + line feed) + 'here's line two'

I will be using it to send a mail from sql server (2000 sp4), so i can build a nice looking mail

> Set @.text1 = 'here's line one' + (carriere return + line feed) + 'here's

> line two'

Set @.text1 = 'here''s one line' + CHAR(13) + CHAR(10) + 'here''s line two';

|||thanks a lot

Carriage Returns and Line Breaks

I have an address field that is coming back as a single field with carriage returns and line breaks and I would like to have it properly wrap in a single box, but the wrapping is all off. How can I get this to properly break? ThanksMake sure you have text box property "cangrow" to true.|||

Nope. That is not the issue. It is cangrow = true.

What I want is to take a field that comes out as:

John Smith CR LB 123 Main Street CR LB Anytown, MA 01888 CR LB USA

as

John Smith

123 Main Street

Anytown, MA 01888

USA

What I am getting is:

John Smith 123

Main Street Anytown,

MA 01888 USA

So I am looking how to read the CR and LBs and maybe replace them with BR tags, not sure.

|||Also... what is being returned to indicate the line break are char(13)s. I am recreating a report that I had lost and was able to resolve this at one time, but forget how I got around it.|||

try select field1 + char(13) + char(10) + field2

Carriage return within column alias

Is there a way to insert a carriage return or line feed in the middle of a column alias within a select statement? I tried using the CHAR function for the ascii value of the carriage return, but SQL Server wouldn't allow it inside the alias name for the column.
Any ideas?What are you trying to achieve with the end result? Is the result to be used in html or something? If so, you can use html tags in the header.|||The database query will be used in an ASP script run from a web site. The problem was that there were so many columns that I couldn't fit them on one page landscape for printing. If I can put some of the column headings (which are declared as aliases in my SQL query) on two lines as opposed to one long heading line, it will save page space.|||The simple solution, then is to put the HTML tag in the alias.. ie

SELECT col1 as 'COLUMN <BR> ONE'
bla bla bla

then when the column header is rendered by the asp, if it is set up correctly, it will put the break in. I believe, however, that there are ways to do this in HTML w/o the need of putting it in the column name.

Hope this helps.

carriage return in label

Hi, any way to code a linefeed/carriage return in a label? I need it for
labels in a pie graph (description on line one, value on line 2 of pie graph
series description).
Any suggestions welcome!
Thanks,
JohnJust use an expression similar to this for the datapoint label expression:
=Fields!Description.Value & vbcrlf & Sum(Fields!X.Value)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"John" <John@.discussions.microsoft.com> wrote in message
news:69F5F15A-D307-49FE-B705-77CB5CE4C7C7@.microsoft.com...
> Hi, any way to code a linefeed/carriage return in a label? I need it for
> labels in a pie graph (description on line one, value on line 2 of pie
> graph
> series description).
> Any suggestions welcome!
> Thanks,
> John
>|||You can also try using System.Environment.NewLine as vbcrlf may not
always be interpreted correctly depending on the report format (PDF,
Excel, HTML,...) you use.
Q
Robert Bruckner [MSFT] wrote:
> Just use an expression similar to this for the datapoint label expression:
> =Fields!Description.Value & vbcrlf & Sum(Fields!X.Value)
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "John" <John@.discussions.microsoft.com> wrote in message
> news:69F5F15A-D307-49FE-B705-77CB5CE4C7C7@.microsoft.com...
> > Hi, any way to code a linefeed/carriage return in a label? I need it for
> > labels in a pie graph (description on line one, value on line 2 of pie
> > graph
> > series description).
> >
> > Any suggestions welcome!
> >
> > Thanks,
> > John
> >|||Works! Thx!
"baseLogiK" wrote:
> You can also try using System.Environment.NewLine as vbcrlf may not
> always be interpreted correctly depending on the report format (PDF,
> Excel, HTML,...) you use.
> Q
> Robert Bruckner [MSFT] wrote:
> > Just use an expression similar to this for the datapoint label expression:
> > =Fields!Description.Value & vbcrlf & Sum(Fields!X.Value)
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> > "John" <John@.discussions.microsoft.com> wrote in message
> > news:69F5F15A-D307-49FE-B705-77CB5CE4C7C7@.microsoft.com...
> > > Hi, any way to code a linefeed/carriage return in a label? I need it for
> > > labels in a pie graph (description on line one, value on line 2 of pie
> > > graph
> > > series description).
> > >
> > > Any suggestions welcome!
> > >
> > > Thanks,
> > > John
> > >
>

carriage return and line feeds

I have a value of 7.5 when I ask for the length (after I have trimmed it)
the value 5 is returned. Visually this is a 3. Someone suggested there may
be a carriage return and line feed (Char(10) and Char(13)) in the column.
How can I remove these if they exist?
Thanks a bunch,What is the data type? Did you try DATALENGTH? Why aren't you using a
numeric data type to store numeric data?
To remove a CHAR(13), for example, you can use REPLACE():
SELECT REPLACE(column_name, CHAR(13), '')
FROM table_name;
"Greg" <Greg@.discussions.microsoft.com> wrote in message
news:D6800B7A-C7C1-4473-9517-618E915B2198@.microsoft.com...
>I have a value of 7.5 when I ask for the length (after I have trimmed it)
> the value 5 is returned. Visually this is a 3. Someone suggested there
> may
> be a carriage return and line feed (Char(10) and Char(13)) in the column.
> How can I remove these if they exist?
> Thanks a bunch,|||"Greg" <Greg@.discussions.microsoft.com> wrote in message
news:D6800B7A-C7C1-4473-9517-618E915B2198@.microsoft.com...
>I have a value of 7.5 when I ask for the length (after I have trimmed it)
> the value 5 is returned. Visually this is a 3. Someone suggested there
> may
> be a carriage return and line feed (Char(10) and Char(13)) in the column.
> How can I remove these if they exist?
> Thanks a bunch,
What datatype is the column?
declare @.dec decimal(5,3)
set @.dec = 7.5
select len(ltrim(rtrim(@.dec)))
...also returns 5.|||I thoguht this was an interesting behavior, so I did a little more
testing...
declare @.dec decimal(5,3)
declare @.var varchar(20)
declare @.char char(10)
set @.dec = 7.5
set @.var = CAST(@.dec AS varchar(20))
set @.char = CAST(@.dec AS char(10))
select len(ltrim(rtrim(@.dec))) as dec
,len(ltrim(rtrim(@.char))) as char
,len(ltrim(rtrim(@.var))) as var
select @.dec as dec
, @.char as char
, @.var as var
RESULTS
dec char var
5 5 5
dec char var
7.500 7.500 7.500
If the number is defined with 3 decimal places, these 3 places are stored as
zeros. Some applications just happen to display the values without trailing
zeros.
"Raymond D'Anjou" <rdanjou@.canatradeNOSPAM.com> wrote in message
news:%23qk9naLOGHA.1676@.TK2MSFTNGP09.phx.gbl...
> "Greg" <Greg@.discussions.microsoft.com> wrote in message
> news:D6800B7A-C7C1-4473-9517-618E915B2198@.microsoft.com...
it)
column.
> What datatype is the column?
> declare @.dec decimal(5,3)
> set @.dec = 7.5
> select len(ltrim(rtrim(@.dec)))
> ...also returns 5.
>|||More fun...
DECLARE @.dec DECIMAL(5,3)
SET @.dec = 7.5
SELECT DATALENGTH(LTRIM(STR(@.dec, 6, 1)))|||Thats cheating.
You reduced the precision.
But here is one more, which I find more puzzling, although I recall other
languages doing strange rounding like this as well.
I can't recall WHY the rounding works like this...
DECLARE @.dec DECIMAL(5,3)
SET @.dec = 7.555
SELECT DATALENGTH(LTRIM(STR(@.dec, 6, 1)))
, LTRIM(STR(@.dec, 6, 1))
SET @.dec = 7.55
SELECT DATALENGTH(LTRIM(STR(@.dec, 6, 1)))
, LTRIM(STR(@.dec, 6, 1))
Results:
3 7.6
3 7.5
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyuhSwLOGHA.2320@.TK2MSFTNGP11.phx.gbl...
> More fun...
> DECLARE @.dec DECIMAL(5,3)
> SET @.dec = 7.5
> SELECT DATALENGTH(LTRIM(STR(@.dec, 6, 1)))
>|||> Thats cheating.
> You reduced the precision.
Well, the extra characters are leading, not trailing. Compare LTRIM() and
RTRIM()...
A|||Aaron and Co.,
Thanks for your replies. Unfortunately, the datatype can't be stored as a
number because results that come in are from many different sources
(Laboratories, Radiology etc) and have different formats. The specific
result I am looking at will always return values like 10.3 or 7.5.
The problem is that for some reason, after I strip the extraneous characters
away(which I have done with ease), I try to cast these values as decimal and
it doesn't work.
Here is code and raw data...it's got me stumped...
There is something still contained in the string that is messing up the
cast. (See raw data below code)
select top 7
patientid,
decodedvalue,
convert(varchar,replace(replace(replace(
decodedvalue,'
',''),'>',''),'%','')) value,
-- cast(convert(varchar,replace(replace(r
eplace(decodedvalue,'
',''),'>',''),'%','')) as float) value,
len(replace(replace(replace(decodedvalue
,' ',''),'>',''),'%','')) str_length
from
#diabetes_results
where
decodedvalue like '%.%'
order by
patientid
58 6.8 % 6.8 3
58 7.6 % 7.6 3
58 6.7 % 6.7 3
58 7.1 % 7.1 3
58 6.2 % 6.2 3
168 7.5 % 7.5 3
168 7.5 7.5 5
Note the length of '5' in the final record though it is obvious the length
should be 3. I trimmed the column of spaces but they remain.
This led me to look at the string lengths of these characters and I
discovered that a few values had what appeared to be spaces in them even
after they were trimmed.
Thanks to all who give their .02.
"Aaron Bertrand [SQL Server MVP]" wrote:

> More fun...
> DECLARE @.dec DECIMAL(5,3)
> SET @.dec = 7.5
> SELECT DATALENGTH(LTRIM(STR(@.dec, 6, 1)))
>
>|||In your sample output there is an extra space before and after the value in
question.
I know your code is removing spaces, but I'm not sure what accounts for the
values in the output.
Can you post your table DDL? What datatype is decodedvalue?
I suspect you have tabs rather than carriage returns, but try this code...
convert(varchar,replace(replace(replace(
replace(replace(@.dec,'
',''),'> ',''),'%',''),char(10),''),char(13),'')c
har(9),''))
Char(10) and Char(13) are a carriage return and line feed (I can never
recall which is which).
Char(9) is a tab character.
Rather than removing the characters you dont want, change the code to keep
only the characters you do want. I'll see if I can track down a sample of
this, but someone else will probably beat me to it.
"Greg" <Greg@.discussions.microsoft.com> wrote in message
news:1125946A-8B58-4424-9F4D-C1FBE98CDA6B@.microsoft.com...
> Aaron and Co.,
> Thanks for your replies. Unfortunately, the datatype can't be stored as a
> number because results that come in are from many different sources
> (Laboratories, Radiology etc) and have different formats. The specific
> result I am looking at will always return values like 10.3 or 7.5.
> The problem is that for some reason, after I strip the extraneous
characters
> away(which I have done with ease), I try to cast these values as decimal
and
> it doesn't work.
> Here is code and raw data...it's got me stumped...
> There is something still contained in the string that is messing up the
> cast. (See raw data below code)
> select top 7
> patientid,
> decodedvalue,
> convert(varchar,replace(replace(replace(
decodedvalue,'
> ',''),'>',''),'%','')) value,
> -- cast(convert(varchar,replace(replace(rep
lace(decodedvalue,'
> ',''),'>',''),'%','')) as float) value,
> len(replace(replace(replace(decodedvalue
,' ',''),'>',''),'%',''))
str_length
> from
> #diabetes_results
> where
> decodedvalue like '%.%'
> order by
> patientid
> 58 6.8 % 6.8 3
> 58 7.6 % 7.6 3
> 58 6.7 % 6.7 3
> 58 7.1 % 7.1 3
> 58 6.2 % 6.2 3
> 168 7.5 % 7.5 3
> 168 7.5 7.5 5
> Note the length of '5' in the final record though it is obvious the length
> should be 3. I trimmed the column of spaces but they remain.
>
> This led me to look at the string lengths of these characters and I
> discovered that a few values had what appeared to be spaces in them even
> after they were trimmed.
> Thanks to all who give their .02.
>
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>|||> Char(10) and Char(13) are a carriage return and line feed (I can never
> recall which is which).
I have two ways of remembering it:
(a) in VB, the constant is named vbCrLf (carriage return, line feed)
(b) they come in inverse order
So, CHAR(13) is carriage return, CHAR(10) is line feed. In some
environments, this is the order it has to be in; in some environments, the
opposite is true. And to make things even more fun, in some environments,
you can have them in either order.
At least that's how I loosely remember it.
A

Carriage Return and Line Feed in TexBox

I want to create a report with a textbox which contains a field followed by a
Carriage Return and Line Feed then another field
e.g
=First(Fields!Field1.Value)+ Carriage Return and Line Feed +
Fields!Field2.Value
How do I do this? I see a suggestion in places for vbCRLF and also \n. But
neither work.
Does vbCRLF apply perhaps to a vb.net environment? I'm in a c# environment.
Many Thanks
--
FionaDMDid you know you can insert another detail row? Just r-click on the row
selector, and insert row below.
Mike G.
"FionaDM" <FionaDM@.discussions.microsoft.com> wrote in message
news:2AD857E3-998C-494F-A9D1-558C430A1848@.microsoft.com...
>I want to create a report with a textbox which contains a field followed by
>a
> Carriage Return and Line Feed then another field
> e.g
> =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> Fields!Field2.Value
> How do I do this? I see a suggestion in places for vbCRLF and also \n. But
> neither work.
> Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
> environment.
> Many Thanks
> --
> FionaDM|||Try using the following:
=First(Fields!Field1.Value) & vbCrLf & Fields!Field2.Value
The Reporting Services expression designer uses VB6 style concatenation
characters so it might have been because you were using the + instead of
the &.
If it still doesn't work try using Environment.NewLine or "\n\r" in place
of vbCrLf but that should work for you. You can see a documented example of
using this in the following article:
http://msdn2.microsoft.com/en-us/library/ms157328.aspx
Just do a search for vbCrLf.
--
Chris Alton, Microsoft Corp.
SQL Server Developer Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
--
> Thread-Topic: Carriage Return and Line Feed in TexBox
> From: =?Utf-8?B?RmlvbmFETQ==?= <FionaDM@.discussions.microsoft.com>
> Subject: Carriage Return and Line Feed in TexBox
> Date: Tue, 2 Oct 2007 06:25:01 -0700
> I want to create a report with a textbox which contains a field followed
by a
> Carriage Return and Line Feed then another field
> e.g
> =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> Fields!Field2.Value
> How do I do this? I see a suggestion in places for vbCRLF and also \n.
But
> neither work.
> Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
environment.
> Many Thanks
> --
> FionaDM
>|||Thanks - & vbCrLf & did the trick
--
FionaDM
"Chris Alton [MSFT]" wrote:
> Try using the following:
> =First(Fields!Field1.Value) & vbCrLf & Fields!Field2.Value
> The Reporting Services expression designer uses VB6 style concatenation
> characters so it might have been because you were using the + instead of
> the &.
> If it still doesn't work try using Environment.NewLine or "\n\r" in place
> of vbCrLf but that should work for you. You can see a documented example of
> using this in the following article:
> http://msdn2.microsoft.com/en-us/library/ms157328.aspx
> Just do a search for vbCrLf.
> --
> Chris Alton, Microsoft Corp.
> SQL Server Developer Support Engineer
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --
> > Thread-Topic: Carriage Return and Line Feed in TexBox
> > From: =?Utf-8?B?RmlvbmFETQ==?= <FionaDM@.discussions.microsoft.com>
> > Subject: Carriage Return and Line Feed in TexBox
> > Date: Tue, 2 Oct 2007 06:25:01 -0700
> >
> > I want to create a report with a textbox which contains a field followed
> by a
> > Carriage Return and Line Feed then another field
> >
> > e.g
> > =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> > Fields!Field2.Value
> >
> > How do I do this? I see a suggestion in places for vbCRLF and also \n.
> But
> > neither work.
> > Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
> environment.
> >
> > Many Thanks
> >
> > --
> > FionaDM
> >
>|||Great. Those concatenation things always got me between VB and C# so you
aren't the only one.
--
Chris Alton, Microsoft Corp.
SQL Server Developer Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
--
> Thread-Topic: Carriage Return and Line Feed in TexBox
> From: <FionaDM@.discussions.microsoft.com>
> Subject: RE: Carriage Return and Line Feed in TexBox
> Date: Wed, 3 Oct 2007 02:56:01 -0700
> Thanks - & vbCrLf & did the trick
> --
> FionaDM
>
> "Chris Alton [MSFT]" wrote:
> > Try using the following:
> > =First(Fields!Field1.Value) & vbCrLf & Fields!Field2.Value
> >
> > The Reporting Services expression designer uses VB6 style concatenation
> > characters so it might have been because you were using the + instead
of
> > the &.
> >
> > If it still doesn't work try using Environment.NewLine or "\n\r" in
place
> > of vbCrLf but that should work for you. You can see a documented
example of
> > using this in the following article:
> >
> > http://msdn2.microsoft.com/en-us/library/ms157328.aspx
> >
> > Just do a search for vbCrLf.
> >
> > --
> > Chris Alton, Microsoft Corp.
> > SQL Server Developer Support Engineer
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> > --
> > > Thread-Topic: Carriage Return and Line Feed in TexBox
> > > From: =?Utf-8?B?RmlvbmFETQ==?= <FionaDM@.discussions.microsoft.com>
> > > Subject: Carriage Return and Line Feed in TexBox
> > > Date: Tue, 2 Oct 2007 06:25:01 -0700
> > >
> > > I want to create a report with a textbox which contains a field
followed
> > by a
> > > Carriage Return and Line Feed then another field
> > >
> > > e.g
> > > =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> > > Fields!Field2.Value
> > >
> > > How do I do this? I see a suggestion in places for vbCRLF and also
\n.
> > But
> > > neither work.
> > > Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
> > environment.
> > >
> > > Many Thanks
> > >
> > > --
> > > FionaDM
> > >
> >
> >
>|||I have also seen controlchars.newline referenced and have personally used
System.Environment.NewLine. Is there one that is most efficient?
"Chris Alton [MSFT]" wrote:
> Great. Those concatenation things always got me between VB and C# so you
> aren't the only one.
> --
> Chris Alton, Microsoft Corp.
> SQL Server Developer Support Engineer
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --
> > Thread-Topic: Carriage Return and Line Feed in TexBox
> > From: <FionaDM@.discussions.microsoft.com>
> > Subject: RE: Carriage Return and Line Feed in TexBox
> > Date: Wed, 3 Oct 2007 02:56:01 -0700
> >
> > Thanks - & vbCrLf & did the trick
> > --
> > FionaDM
> >
> >
> > "Chris Alton [MSFT]" wrote:
> >
> > > Try using the following:
> > > =First(Fields!Field1.Value) & vbCrLf & Fields!Field2.Value
> > >
> > > The Reporting Services expression designer uses VB6 style concatenation
> > > characters so it might have been because you were using the + instead
> of
> > > the &.
> > >
> > > If it still doesn't work try using Environment.NewLine or "\n\r" in
> place
> > > of vbCrLf but that should work for you. You can see a documented
> example of
> > > using this in the following article:
> > >
> > > http://msdn2.microsoft.com/en-us/library/ms157328.aspx
> > >
> > > Just do a search for vbCrLf.
> > >
> > > --
> > > Chris Alton, Microsoft Corp.
> > > SQL Server Developer Support Engineer
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > > --
> > > > Thread-Topic: Carriage Return and Line Feed in TexBox
> > > > From: =?Utf-8?B?RmlvbmFETQ==?= <FionaDM@.discussions.microsoft.com>
> > > > Subject: Carriage Return and Line Feed in TexBox
> > > > Date: Tue, 2 Oct 2007 06:25:01 -0700
> > > >
> > > > I want to create a report with a textbox which contains a field
> followed
> > > by a
> > > > Carriage Return and Line Feed then another field
> > > >
> > > > e.g
> > > > =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> > > > Fields!Field2.Value
> > > >
> > > > How do I do this? I see a suggestion in places for vbCRLF and also
> \n.
> > > But
> > > > neither work.
> > > > Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
> > > environment.
> > > >
> > > > Many Thanks
> > > >
> > > > --
> > > > FionaDM
> > > >
> > >
> > >
> >
>|||I personally haven't tried using either of those in a report but since it
supports .NET namespaces I don't see why it wouldn't.
--
Chris Alton, Microsoft Corp.
SQL Server Developer Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
--
> Thread-Topic: Carriage Return and Line Feed in TexBox
> thread-index: AcgHaTZxHlx+/uxhRJCGUmWO9AQkmQ==> X-WBNR-Posting-Host: 207.46.19.197
> From: =?Utf-8?B?V2lsbGlhbQ==?= <William@.discussions.microsoft.com>
> References: <2AD857E3-998C-494F-A9D1-558C430A1848@.microsoft.com>
<pGoU9QQBIHA.240@.TK2MSFTNGHUB02.phx.gbl>
<EF5C20BB-CFAB-4622-96D2-2F45B21444AC@.microsoft.com>
<e6Gm4coBIHA.240@.TK2MSFTNGHUB02.phx.gbl>
> Subject: RE: Carriage Return and Line Feed in TexBox
> Date: Fri, 5 Oct 2007 09:03:04 -0700
> I have also seen controlchars.newline referenced and have personally used
> System.Environment.NewLine. Is there one that is most efficient?
> "Chris Alton [MSFT]" wrote:
> > Great. Those concatenation things always got me between VB and C# so
you
> > aren't the only one.
> >
> > --
> > Chris Alton, Microsoft Corp.
> > SQL Server Developer Support Engineer
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> > --
> > > Thread-Topic: Carriage Return and Line Feed in TexBox
> > > From: <FionaDM@.discussions.microsoft.com>
> > > Subject: RE: Carriage Return and Line Feed in TexBox
> > > Date: Wed, 3 Oct 2007 02:56:01 -0700
> > >
> > > Thanks - & vbCrLf & did the trick
> > > --
> > > FionaDM
> > >
> > >
> > > "Chris Alton [MSFT]" wrote:
> > >
> > > > Try using the following:
> > > > =First(Fields!Field1.Value) & vbCrLf & Fields!Field2.Value
> > > >
> > > > The Reporting Services expression designer uses VB6 style
concatenation
> > > > characters so it might have been because you were using the +
instead
> > of
> > > > the &.
> > > >
> > > > If it still doesn't work try using Environment.NewLine or "\n\r" in
> > place
> > > > of vbCrLf but that should work for you. You can see a documented
> > example of
> > > > using this in the following article:
> > > >
> > > > http://msdn2.microsoft.com/en-us/library/ms157328.aspx
> > > >
> > > > Just do a search for vbCrLf.
> > > >
> > > > --
> > > > Chris Alton, Microsoft Corp.
> > > > SQL Server Developer Support Engineer
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > > > --
> > > > > Thread-Topic: Carriage Return and Line Feed in TexBox
> > > > > From: =?Utf-8?B?RmlvbmFETQ==?= <FionaDM@.discussions.microsoft.com>
> > > > > Subject: Carriage Return and Line Feed in TexBox
> > > > > Date: Tue, 2 Oct 2007 06:25:01 -0700
> > > > >
> > > > > I want to create a report with a textbox which contains a field
> > followed
> > > > by a
> > > > > Carriage Return and Line Feed then another field
> > > > >
> > > > > e.g
> > > > > =First(Fields!Field1.Value)+ Carriage Return and Line Feed +
> > > > > Fields!Field2.Value
> > > > >
> > > > > How do I do this? I see a suggestion in places for vbCRLF and
also
> > \n.
> > > > But
> > > > > neither work.
> > > > > Does vbCRLF apply perhaps to a vb.net environment? I'm in a c#
> > > > environment.
> > > > >
> > > > > Many Thanks
> > > > >
> > > > > --
> > > > > FionaDM
> > > > >
> > > >
> > > >
> > >
> >
> >
>

Carriage return /New line in a Text field

Hi
Is there any way to force a carriage return/new line when inserting some
data into a text field?
I'm updating a text field with data from other fields, but in order to make
it look nice on a printout, I'd like to split it onto two lines. I've looked
in BOL, but haven't really been able to find anything that seems to be able
to do it.
Regards
Steen
Hi Steen,
Please check CHAR in SQL BOL.
I believe CHAR(13) is what you are looking for.
Cheers,
Des
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:u7O7RBvmEHA.3988@.tk2msftngp13.phx.gbl...
> Hi
> Is there any way to force a carriage return/new line when inserting some
> data into a text field?
> I'm updating a text field with data from other fields, but in order to
> make
> it look nice on a printout, I'd like to split it onto two lines. I've
> looked
> in BOL, but haven't really been able to find anything that seems to be
> able
> to do it.
> Regards
> Steen
>
|||Yes - that looks like what I was looking for.
Thanks a lot...
Regards
Steen
Des FitzGerald wrote:[vbcol=seagreen]
> Hi Steen,
> Please check CHAR in SQL BOL.
> I believe CHAR(13) is what you are looking for.
> Cheers,
> Des
>
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:u7O7RBvmEHA.3988@.tk2msftngp13.phx.gbl...
|||You may actually need to use a combination of char(13) +
char(10) depending on your settings. Windows apps
sometimes look for both (Carriage return/linefeed). UNIX
based systems generally only look for the one control
character (Carriage return is a carriage return, line
feed feeds a line but doesn't change your horizontal
position).
Just a thought.
Matthew Bando
Mattehw.Bando@.remove csctgi.com
[vbcol=seagreen]
>--Original Message--
>Yes - that looks like what I was looking for.
>Thanks a lot...
>
>Regards
>Steen
>Des FitzGerald wrote:
when inserting[vbcol=seagreen]
fields, but in order[vbcol=seagreen]
two lines. I've[vbcol=seagreen]
that seems to
>
>.
>

Carriage return /New line in a Text field

Hi
Is there any way to force a carriage return/new line when inserting some
data into a text field?
I'm updating a text field with data from other fields, but in order to make
it look nice on a printout, I'd like to split it onto two lines. I've looked
in BOL, but haven't really been able to find anything that seems to be able
to do it.
Regards
SteenHi Steen,
Please check CHAR in SQL BOL.
I believe CHAR(13) is what you are looking for.
Cheers,
Des
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:u7O7RBvmEHA.3988@.tk2msftngp13.phx.gbl...
> Hi
> Is there any way to force a carriage return/new line when inserting some
> data into a text field?
> I'm updating a text field with data from other fields, but in order to
> make
> it look nice on a printout, I'd like to split it onto two lines. I've
> looked
> in BOL, but haven't really been able to find anything that seems to be
> able
> to do it.
> Regards
> Steen
>|||Yes - that looks like what I was looking for.
Thanks a lot...
Regards
Steen
Des FitzGerald wrote:
> Hi Steen,
> Please check CHAR in SQL BOL.
> I believe CHAR(13) is what you are looking for.
> Cheers,
> Des
>
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:u7O7RBvmEHA.3988@.tk2msftngp13.phx.gbl...
>> Hi
>> Is there any way to force a carriage return/new line when inserting
>> some data into a text field?
>> I'm updating a text field with data from other fields, but in order
>> to make
>> it look nice on a printout, I'd like to split it onto two lines. I've
>> looked
>> in BOL, but haven't really been able to find anything that seems to
>> be able
>> to do it.
>> Regards
>> Steen|||You may actually need to use a combination of char(13) +
char(10) depending on your settings. Windows apps
sometimes look for both (Carriage return/linefeed). UNIX
based systems generally only look for the one control
character (Carriage return is a carriage return, line
feed feeds a line but doesn't change your horizontal
position).
Just a thought.
Matthew Bando
Mattehw.Bando@.remove csctgi.com
>--Original Message--
>Yes - that looks like what I was looking for.
>Thanks a lot...
>
>Regards
>Steen
>Des FitzGerald wrote:
>> Hi Steen,
>> Please check CHAR in SQL BOL.
>> I believe CHAR(13) is what you are looking for.
>> Cheers,
>> Des
>>
>> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
>> news:u7O7RBvmEHA.3988@.tk2msftngp13.phx.gbl...
>> Hi
>> Is there any way to force a carriage return/new line
when inserting
>> some data into a text field?
>> I'm updating a text field with data from other
fields, but in order
>> to make
>> it look nice on a printout, I'd like to split it onto
two lines. I've
>> looked
>> in BOL, but haven't really been able to find anything
that seems to
>> be able
>> to do it.
>> Regards
>> Steen
>
>.
>|||Steen Persson wrote:
> *Hi
> Is there any way to force a carriage return/new line when inserting
> some
> data into a text field?
> I'm updating a text field with data from other fields, but in order
> to make
> it look nice on a printout, I'd like to split it onto two lines. I've
> looked
> in BOL, but haven't really been able to find anything that seems to
> be able
> to do it.
> Regards
> Steen *
fmutale02
---
Posted via http://www.webservertalk.com
---
View this thread: http://www.webservertalk.com/message393908.html|||Use a string funtion to select the fisrt part of a string and separate it
with a char(13) or concatenate multiple fileds with the char(13) in between.
Such as
insert into table
select left(field1,10)+char(13)+right(field1,10) from table
or
insert into table
select field1+char(13)+field2
"fmutale02" wrote:
> Steen Persson wrote:
> > *Hi
> >
> > Is there any way to force a carriage return/new line when inserting
> > some
> > data into a text field?
> >
> > I'm updating a text field with data from other fields, but in order
> > to make
> > it look nice on a printout, I'd like to split it onto two lines. I've
> > looked
> > in BOL, but haven't really been able to find anything that seems to
> > be able
> > to do it.
> >
> > Regards
> > Steen *
>
> --
> fmutale02
> ---
> Posted via http://www.webservertalk.com
> ---
> View this thread: http://www.webservertalk.com/message393908.html
>|||Some printers may need both char(13)+char(10) to cause a linefeed.
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Jeff Ericson" <JeffEricson@.discussions.microsoft.com> wrote in message
news:358376A2-847C-4108-B5AD-3E615E8A7BB9@.microsoft.com...
> Use a string funtion to select the fisrt part of a string and separate it
> with a char(13) or concatenate multiple fileds with the char(13) in
> between.
> Such as
> insert into table
> select left(field1,10)+char(13)+right(field1,10) from table
> or
> insert into table
> select field1+char(13)+field2
>
>
> "fmutale02" wrote:
>> Steen Persson wrote:
>> > *Hi
>> >
>> > Is there any way to force a carriage return/new line when inserting
>> > some
>> > data into a text field?
>> >
>> > I'm updating a text field with data from other fields, but in order
>> > to make
>> > it look nice on a printout, I'd like to split it onto two lines. I've
>> > looked
>> > in BOL, but haven't really been able to find anything that seems to
>> > be able
>> > to do it.
>> >
>> > Regards
>> > Steen *
>>
>> --
>> fmutale02
>> ---
>> Posted via http://www.webservertalk.com
>> ---
>> View this thread: http://www.webservertalk.com/message393908.html
>>

Carriage Return ,VBCrLf in PDF

Hi,
I have a report render out in PDF. There's a Employee Preference
column which has "<BR>" to display each item on a new line. It works
ok by using Replace "BR" with VbCrLf, but there is a problem when
viewing in PDF.
For example: Red <BR> Blue <BR> Green, should be displayed as:
Red
Blue
Green
but after replace BR with a VbCrLf, the result displayed in multple
lines but there's always a mystery empty character in front of the
second line.
Red
Blue
Green.
ANyone have any ideas?
ThanksMike,
I am not sure if this will solve your problem; but I use
"System.Environment.NewLine" in my report to produce a newline.
So for example:
=Fields!Color.Value & System.Environment.NewLine & Fields!Color.Value ....
See if that works.
Rob Cuscaden
"MikeT" wrote:
> Hi,
> I have a report render out in PDF. There's a Employee Preference
> column which has "<BR>" to display each item on a new line. It works
> ok by using Replace "BR" with VbCrLf, but there is a problem when
> viewing in PDF.
> For example: Red <BR> Blue <BR> Green, should be displayed as:
> Red
> Blue
> Green
> but after replace BR with a VbCrLf, the result displayed in multple
> lines but there's always a mystery empty character in front of the
> second line.
> Red
> Blue
> Green.
> ANyone have any ideas?
> Thanks
>

carraige return

This is an easy question, I have two address fields and I have combine them
together but I want address_2 to show up on the next line instead of have a
sapce between address1 and address2
Any Idea
Thank in Advance
=Fields!BILLING_ADDRESS.Value & " " Fields!BILLING_ADDRESS_2.Value=Fields!BILLING_ADDRESS.Value & ControlChars.CrLf &
Fields!BILLING_ADDRESS_2.Value
--
Med Bouchenafa
"superQ" <superQ@.discussions.microsoft.com> a écrit dans le message de news:
5E9BA72C-7B82-447F-BA54-4F8251A3E9A8@.microsoft.com...
> This is an easy question, I have two address fields and I have combine
> them
> together but I want address_2 to show up on the next line instead of have
> a
> sapce between address1 and address2
> Any Idea
> Thank in Advance
> =Fields!BILLING_ADDRESS.Value & " " Fields!BILLING_ADDRESS_2.Value

Sunday, February 19, 2012

capture line of flat file [Error]

Hi,

I have a flat file with several rows of entire type in one of the rows a string comes and when it goes away to guard in the BD it falls, since I can know in that this row of the flat file the string?

I'd like to help but I am not sure I followed your question. Can you calrify?

Rafael Salas

|||

PastillaReturn wrote:

Hi,

I have a flat file with several rows of entire type in one of the rows a string comes and when it goes away to guard in the BD it falls, since I can know in that this row of the flat file the string?

Sorry, this is getting lost in translation. Do you mean that you require to know which row(s) of the flat file failed?

-Jamie

|||

yes

|||

This isn't currently possible. If you want to change that, go here, vote, and add a comment:

Row numbers added to pipeline
(https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=131335)

-Jamie