Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Tuesday, March 20, 2012

check if cursor exists

I declare a cusror named crInv inside a loop.
Since I open this cursor a lot of times I want to check if is already opened.
I try to use the Cursor_status function but it always returns -3.
The syntax is:

DECLARE crInv SCROL CURSOR FOR
SELECT Val1, Val2 FROM TABLE1 WHERE Val3=450

If Cursor_Status('local','crInv')>0 BEGIN
CLOSE crInv
DEALLOCATE crInv
END

This code is inside a loop.
If I PRINT Cursor_Status('local','crInv') before and after the DECLARE statement it always returns -3.
What is wrong??

Best regards,
ManolisDECLARE crInv LOCAL SCROLL CURSOR FOR ...

The typical default for a cursor is GLOBAL|||Sounds like an extremely expensive process...

Ever think about a set based process?

Can you post the "Loop" code?sql

Wednesday, March 7, 2012

ChartType in RunTime

Could I set up Chart type in run-time. The attempt to set <Type> attribute
inside RDL in the following way:
<Chart Name="1">
...
<Type> = Parameters!ReportChart.Value</Type>
was failed
"Deserialization failed: Requested value =Parameters!ChartType.Value was not
found."
Any suggestion?
Regards
YuriPlease read these postings:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=eda1cbbf-cb32-4ae3-903b-eff73af5cdc6&sloc=en-us
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=a1325500-ca6c-4a71-ad3f-6a59dac96d88&sloc=en-us
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Yuri Belenky" <yurib@.mercatus.no> wrote in message
news:u3HYLMGgEHA.536@.TK2MSFTNGP11.phx.gbl...
> Could I set up Chart type in run-time. The attempt to set <Type> attribute
> inside RDL in the following way:
> <Chart Name="1">
> ...
> <Type> = Parameters!ReportChart.Value</Type>
> was failed
> "Deserialization failed: Requested value =Parameters!ChartType.Value was
not
> found."
> Any suggestion?
> Regards
> Yuri
>|||Thanks a lot.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:O3lz4oIgEHA.3932@.TK2MSFTNGP09.phx.gbl...
> Please read these postings:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=eda1cbbf-cb32-4ae3-903b-eff73af5cdc6&sloc=en-us
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=a1325500-ca6c-4a71-ad3f-6a59dac96d88&sloc=en-us
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "Yuri Belenky" <yurib@.mercatus.no> wrote in message
> news:u3HYLMGgEHA.536@.TK2MSFTNGP11.phx.gbl...
>> Could I set up Chart type in run-time. The attempt to set <Type>
>> attribute
>> inside RDL in the following way:
>> <Chart Name="1">
>> ...
>> <Type> = Parameters!ReportChart.Value</Type>
>> was failed
>> "Deserialization failed: Requested value =Parameters!ChartType.Value was
> not
>> found."
>> Any suggestion?
>> Regards
>> Yuri
>>
>|||Hi Robert,
I have this same question, although when i click the links they dont work'
Any help would be great.
Thanks in Advance
Shea
"Robert Bruckner [MSFT]" wrote:
> Please read these postings:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=eda1cbbf-cb32-4ae3-903b-eff73af5cdc6&sloc=en-us
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=a1325500-ca6c-4a71-ad3f-6a59dac96d88&sloc=en-us
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Yuri Belenky" <yurib@.mercatus.no> wrote in message
> news:u3HYLMGgEHA.536@.TK2MSFTNGP11.phx.gbl...
> > Could I set up Chart type in run-time. The attempt to set <Type> attribute
> > inside RDL in the following way:
> > <Chart Name="1">
> > ...
> > <Type> = Parameters!ReportChart.Value</Type>
> >
> > was failed
> > "Deserialization failed: Requested value =Parameters!ChartType.Value was
> not
> > found."
> >
> > Any suggestion?
> >
> > Regards
> > Yuri
> >
> >
>
>|||Unfortunately, the news server does not keep an unlimited history of
postings. It seems that both threads have been already removed because they
were too old.
To answer the question: dynamic expression-based chart types are not
available. The closest you can get today is to have multiple charts defined
in your report with different chart types and dynamically hide all of them
(through the Visibility.Hidden property) except for the one you want show.
If you want to change the chart type based on the amount of datapoints, you
might also want to look into using drillthrough actions on the chart. The
main chart would show an aggregated view of the data. Clicking on one of the
data points will then drill through to another report with a detailed view
of the data.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shea Strickland" <SheaStrickland@.discussions.microsoft.com> wrote in
message news:6A9B2659-3337-4186-B189-CC4FB7CDC7D6@.microsoft.com...
> Hi Robert,
> I have this same question, although when i click the links they dont
work'
> Any help would be great.
> Thanks in Advance
> Shea
> "Robert Bruckner [MSFT]" wrote:
> > Please read these postings:
> >
> >
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=eda1cbbf-cb32-4ae3-903b-eff73af5cdc6&sloc=en-us
> >
> >
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=a1325500-ca6c-4a71-ad3f-6a59dac96d88&sloc=en-us
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Yuri Belenky" <yurib@.mercatus.no> wrote in message
> > news:u3HYLMGgEHA.536@.TK2MSFTNGP11.phx.gbl...
> > > Could I set up Chart type in run-time. The attempt to set <Type>
attribute
> > > inside RDL in the following way:
> > > <Chart Name="1">
> > > ...
> > > <Type> = Parameters!ReportChart.Value</Type>
> > >
> > > was failed
> > > "Deserialization failed: Requested value =Parameters!ChartType.Value
was
> > not
> > > found."
> > >
> > > Any suggestion?
> > >
> > > Regards
> > > Yuri
> > >
> > >
> >
> >
> >|||Robert,
Thanks for the speedy reply, I was heading that way, that post just sounded
like you could do dynamic chart types.
Thanks Again
Shea
"Robert Bruckner [MSFT]" wrote:
> Unfortunately, the news server does not keep an unlimited history of
> postings. It seems that both threads have been already removed because they
> were too old.
> To answer the question: dynamic expression-based chart types are not
> available. The closest you can get today is to have multiple charts defined
> in your report with different chart types and dynamically hide all of them
> (through the Visibility.Hidden property) except for the one you want show.
> If you want to change the chart type based on the amount of datapoints, you
> might also want to look into using drillthrough actions on the chart. The
> main chart would show an aggregated view of the data. Clicking on one of the
> data points will then drill through to another report with a detailed view
> of the data.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Shea Strickland" <SheaStrickland@.discussions.microsoft.com> wrote in
> message news:6A9B2659-3337-4186-B189-CC4FB7CDC7D6@.microsoft.com...
> > Hi Robert,
> >
> > I have this same question, although when i click the links they dont
> work'
> >
> > Any help would be great.
> >
> > Thanks in Advance
> > Shea
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> > > Please read these postings:
> > >
> > >
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=eda1cbbf-cb32-4ae3-903b-eff73af5cdc6&sloc=en-us
> > >
> > >
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=a1325500-ca6c-4a71-ad3f-6a59dac96d88&sloc=en-us
> > >
> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > >
> > > "Yuri Belenky" <yurib@.mercatus.no> wrote in message
> > > news:u3HYLMGgEHA.536@.TK2MSFTNGP11.phx.gbl...
> > > > Could I set up Chart type in run-time. The attempt to set <Type>
> attribute
> > > > inside RDL in the following way:
> > > > <Chart Name="1">
> > > > ...
> > > > <Type> = Parameters!ReportChart.Value</Type>
> > > >
> > > > was failed
> > > > "Deserialization failed: Requested value =Parameters!ChartType.Value
> was
> > > not
> > > > found."
> > > >
> > > > Any suggestion?
> > > >
> > > > Regards
> > > > Yuri
> > > >
> > > >
> > >
> > >
> > >
>
>

Saturday, February 25, 2012

Chart, how do I use format code for a label?

How do I refer to the actual value for the label inside my expression?
Say you have datetime data across the x-axis for the data. I get one row per
month in the dataset (every row is same date and time for each row/month). I
understand how I can format this, for instance "MMM" to get month name in
short format.
But if I want to do further or a bit more complex manipulation? In this
case, I want to show only first letter of the month. I fail to connect how
to put the actual data value inside my VB.NET expression (substring, left or
similar function in this case).
(I can retrieve the first letter of the month along with the data, as an
extra column, doing this in my stored procedure. If above is difficult, I'd
appreciate tips on how to refer to this column for the chart label. I.e., I
want to show some other column as the label, not the one used to derive the
actual value.)
TIA
Tibor Karaszi
SQL Server MVPExpressions for formatting labels are not directly supported in the current
release. You could do a bar chart and use an expression
(=Left(Format(Fields!OrderDate.Value, "MMM"), 1)) for the corresponding
category group. The sample report attached at the end of this post (which
runs against local Northwind database) demonstrates this.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OEwX0qaiEHA.2848@.TK2MSFTNGP10.phx.gbl...
> How do I refer to the actual value for the label inside my expression?
> Say you have datetime data across the x-axis for the data. I get one row
per
> month in the dataset (every row is same date and time for each row/month).
I
> understand how I can format this, for instance "MMM" to get month name in
> short format.
> But if I want to do further or a bit more complex manipulation? In this
> case, I want to show only first letter of the month. I fail to connect how
> to put the actual data value inside my VB.NET expression (substring, left
or
> similar function in this case).
> (I can retrieve the first letter of the month along with the data, as an
> extra column, doing this in my stored procedure. If above is difficult,
I'd
> appreciate tips on how to refer to this column for the chart label. I.e.,
I
> want to show some other column as the label, not the one used to derive
the
> actual value.)
> TIA
> Tibor Karaszi
> SQL Server MVP
>
+++++++++++++ Sample report +++++++++++++
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
tion"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Body>
<ReportItems>
<Chart Name="chart1">
<ThreeDProperties>
<Rotation>30</Rotation>
<Inclination>30</Inclination>
<Shading>Simple</Shading>
<WallThickness>50</WallThickness>
</ThreeDProperties>
<Style>
<BackgroundColor>White</BackgroundColor>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>RightCenter</Position>
</Legend>
<Palette>Default</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Sum(Fields!Freight.Value)</Value>
</DataValue>
</DataValues>
<DataLabel />
<Marker />
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title />
<Style>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Visible>true</Visible>
</Axis>
</CategoryAxis>
<DataSetName>Northwind</DataSetName>
<PointWidth>0</PointWidth>
<Type>Bar</Type>
<Title />
<Width>5.25in</Width>
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="chart1_CategoryGroup1">
<GroupExpressions>
<GroupExpression>=Fields!OrderDate.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Left(Format(Fields!OrderDate.Value, "MMM"), 1) & "
[" & Format(Fields!OrderDate.Value, "MMM yyyy") & "]"</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>LightGrey</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<ValueAxis>
<Axis>
<Title />
<Style>
<Format>c</Format>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>3in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>14b06457-afff-49a5-9624-2ecc74ef5643</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>initial catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>6.25in</Width>
<DataSets>
<DataSet Name="Northwind">
<Fields>
<Field Name="OrderDate">
<DataField>OrderDate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="Freight">
<DataField>Freight</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT TOP 10 OrderDate, Freight
FROM Orders
ORDER BY ShipCity</CommandText>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>b8405333-c29c-4c57-8ba3-7915ae7bf5eb</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>

Thursday, February 16, 2012

Chart - Point Labels inside the Bar

Hi People,

I'm with a new problem.

I creted a simple bar type and sometimes the values of point labels are showing inside of bar, This is a problema, because if the length of bar will be short, the value doesn't shows. How can I make to force the point label value outside of bar ?

Thanks

it has a legend loc on the data field properties.

you can change the location by choosing from the 9 blocks.

Chart - Point Labels inside the Bar

Hi People,

I'm with a new problem.

I creted a simple bar type and sometimes the values of point labels are showing inside of bar, This is a problema, because if the length of bar will be short, the value doesn't shows. How can I make to force the point label value outside of bar ?

Thanks

it has a legend loc on the data field properties.

you can change the location by choosing from the 9 blocks.

Tuesday, February 14, 2012

Character limit for variables inside a stocked procedure

I am currently having a problem where my SQL server seems to lock any variables to 1000 characters (ie. varchar(8000) can only hold 1000)

I have read in numerous sources it was possible to change that limit so the varchar can truly hold the 8000 characters and not stop at 1000, but there was no info on how to do this.

I am looking for a "How to" to put this limit to 8000.

Thank you!

Try Varchar(MAX) . It should help you.|||

Hi , see this link

http://www.sqlmag.com/Articles/ArticleID/26654/pg/2/2.html

|||

How you insert data to your field? Are you use stored procedure or any type of parameter? check the size of your parameter if it is not limited to 1000 chars, I never had problems with varchar(8000) like you so check the way how you insert value to your cell.

Thanks

|||

The problem is with the SQL Server itself, it has no relation to the type of variable or any data passed to the sotred procedure. The number of character that a stored procedure variable CANNOT exceed 1000.

Thus, even if I do :

DECLARE @.SQL varchar(8000)

The @.SQL will not hold more than 1000 characters. And I need to fix that and cannot seem to find were to do so. 1000 character is fine for quite simple task, but we had some stocked procedure that would have required over 10K characters in order to do what we wanted to do.

If you have any idea on how to change the limitation on the number of character a variable within a stored procedure can hold, I am looking for it since it is quite limitating.

|||

Veritek:

The problem is with the SQL Server itself, it has no relation to the type of variable or any data passed to the sotred procedure. The number of character that a stored procedure variable CANNOT exceed 1000.

I believe you are mistaken.

Try this from Query Analyzer:

DECLARE @.test varchar(2000)
SELECT @.test = REPLICATE('1',1000) + REPLICATE('2',700)
PRINT LEN(@.test)
PRINT @.test

You will see that the length returned is 1700. And that the string printed contains both 1's and 2's.

Your problem lies elsewhere. Something else is truncating your data at 1000 characters.

|||Affirmative, length is indeed 1700... But then I do not know where I could look ...|||

Veritek:

Affirmative, length is indeed 1700... But then I do not know where I could look ...

Well, either do we since we haven't seen any code...

jpazgier has suggested that you review your parameters to make sure you are not truncating data before it gets to your stored procedure.

|||

Well, still unresolved, and wont be anytime soon now since I would seem to have a new problem with the server.

Since the stocked procedure is receiving data from an aspx/vb set of files. Even when the .vb is of size 0.

Reinstalling the softwares seem in order now...

Thank you tho for the help!

|||

Well, we actually had to disable the SP causing the problem since during the weekend it simply stoped working and kept returning an error which we fail to see where it comes from.

I think we need to upgrade our software :p

|||

Veritek:

Thus, even if I do :

DECLARE @.SQL varchar(8000)

The @.SQL will not hold more than 1000 characters.

How are you determining that @.SQL will not hold more than 1000 characters? Again, you've really not shown us any of your code so it's difficult for us to help. I strongly doubt that reinstalling software is the answer.