Showing posts with label based. Show all posts
Showing posts with label based. Show all posts

Wednesday, March 28, 2012

How do i limit number of rows in a table based on dates?

Hi,
My application is written in c# and uses sql Express to store
information relating to what time employees clock in/out of work each
day.
How can i restrict the amount of rows in my attendance database table
so that entries older than 3 months are automatically deleted from the
database?
Thanks in advance!
KHi
I'd create a stored procedure that does deletion and then create a
job(weekly...) that will run this SP
<kls.systems@.btinternet.com> wrote in message
news:1176719432.941536.219550@.o5g2000hsb.googlegroups.com...
> Hi,
> My application is written in c# and uses sql Express to store
> information relating to what time employees clock in/out of work each
> day.
> How can i restrict the amount of rows in my attendance database table
> so that entries older than 3 months are automatically deleted from the
> database?
> Thanks in advance!
> K
>|||Thanks for the help uri, I thought that sql express couldnt use
scheduled jobs though as it doesnt use sql agent?
Thanks again.|||Ah I see, did not read properly your post
Perhaps here you will find some info
Automating Database maintenance in SQL 2005 Express Edition Part I
http://www.sqldbatips.com/showarticle.asp?ID=27
Automating Database maintenance in SQL 2005 Express Edition Part II
http://www.sqldbatips.com/showarticle.asp?ID=29
<kls.systems@.btinternet.com> wrote in message
news:1176721669.824203.42940@.l77g2000hsb.googlegroups.com...
> Thanks for the help uri, I thought that sql express couldnt use
> scheduled jobs though as it doesnt use sql agent?
> Thanks again.
>|||How about using a .sql script file, execute it using SQLCMD (in a .bat file) and use the Windows
scheduler to execute that .bat file?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<kls.systems@.btinternet.com> wrote in message
news:1176721669.824203.42940@.l77g2000hsb.googlegroups.com...
> Thanks for the help uri, I thought that sql express couldnt use
> scheduled jobs though as it doesnt use sql agent?
> Thanks again.
>|||On 16 Apr, 12:22, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Ah I see, did not read properly your post
> Perhaps here you will find some info
> Automating Database maintenance in SQL 2005 Express Edition Part Ihttp://www.sqldbatips.com/showarticle.asp?ID=27
> Automating Database maintenance in SQL 2005 Express Edition Part IIhttp://www.sqldbatips.com/showarticle.asp?ID=29
> <kls.syst...@.btinternet.com> wrote in message
> news:1176721669.824203.42940@.l77g2000hsb.googlegroups.com...
>
> > Thanks for the help uri, I thought that sql express couldnt use
> > scheduled jobs though as it doesnt use sql agent?
> > Thanks again.- Hide quoted text -
> - Show quoted text -|||Thanks very much for all of your help, I'll try setting up a windows
scheduled job to run an sql script to do this as suggested in the
articles you provided links for.
I just thought there would have been a quick and easy setting within
management studio express i could configure to do it but nevermind!
Thanks very much again for your help Uri, very much appreciated.

Monday, March 26, 2012

How do I jump to another report based on a value in my current report? report has no parameters.

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

Hello,

Does your target report have parameters? For example, you want to go to the target report and run it with the value you selected on the current report?

Or are you saying... If the field value is between a and b, go to report 1, if it's between b and c, go to report 2, otherwise go to report 3.

Can you explain a little more about your situation?

Jarret

|||

the report I am jumping from has no parameters. I want to be able to click on a value and have it jump to another report. That report possibly being jumped too might or might not have parameters.

I just used the following expression and it works to a degree, but it enables all the values in the column for jumping, rather than just the report I want

=iif(Fields!YN_DESC.Value="A","Report 1","Report2")

|||

Sorry for the delay...

This will only enable the "A" values to jump to a report (Report 1), any other values will not have the jump to enabled.

=Switch(Fields!YN_Desc.Value = "A", "Report 1")

If you need to add additional conditions... Example, if the value is "C" - Report 31, "D" - Report 7.

=Switch(Fields!YN_Desc.Value = "A", "Report 1",
Fields!YN_Desc.Value = "C", "Report 31",
Fields!YN_Desc.Value = "D", "Report 7")

Hope this helps.

Jarret

How do I jump to another report based on a value in my current report? report has no parameters.

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

Hello,

Does your target report have parameters? For example, you want to go to the target report and run it with the value you selected on the current report?

Or are you saying... If the field value is between a and b, go to report 1, if it's between b and c, go to report 2, otherwise go to report 3.

Can you explain a little more about your situation?

Jarret

|||

the report I am jumping from has no parameters. I want to be able to click on a value and have it jump to another report. That report possibly being jumped too might or might not have parameters.

I just used the following expression and it works to a degree, but it enables all the values in the column for jumping, rather than just the report I want

=iif(Fields!YN_DESC.Value="A","Report 1","Report2")

|||

Sorry for the delay...

This will only enable the "A" values to jump to a report (Report 1), any other values will not have the jump to enabled.

=Switch(Fields!YN_Desc.Value = "A", "Report 1")

If you need to add additional conditions... Example, if the value is "C" - Report 31, "D" - Report 7.

=Switch(Fields!YN_Desc.Value = "A", "Report 1",
Fields!YN_Desc.Value = "C", "Report 31",
Fields!YN_Desc.Value = "D", "Report 7")

Hope this helps.

Jarret

How do I jump to another report based on a value

How do I jump to another report based on a value in my current report?

Right-click on the field you wish to link, select Navigation, select jump to report, and specify the report and any parameters required.

Here are a couple of links that may help.

http://msdn2.microsoft.com/en-us/library/aa964132.aspx

http://www.codeproject.com/useritems/InputParmReport.asp?df=100&forumid=290297&exp=0&select=1472409

cheers,

Andrew

|||

Thanks Andrew,

The examples that you gave me are based on parameters. I made a mistake. What I actually need is to be able to jump to a

report based on a value in one of the report columns. The report that I am jumping from has no parameters and is just a table with

columns and values. How can I do this?

|||

Hi,

you can use the hyperlink action "jump to report" using an expression like this:

=IIf(Logical_Expression, "reportname 1", "reportname 2")

Best regards

Sven

|||

Hi Sven

I tried doing this and it jumps to the report. The problem I am encountering is that the whole column is being enabled to jump rather than just the selected being enabled when the user passes his cursour over it. How do I enable just that value and not all the column values?

|||Hi,
then you have to use the switch-function instead of the iif-function.
=switch(Logical_Expression, "reportname")
br
Sven

Friday, March 23, 2012

How do i implement If Then Else Conditions

Hi All,

I'm very new to Integration Services. Self Learned this ETL tool based on my prior ETL tool knowledge.

Can you tell me how do write IF Then Else conditions for every column in my source and redirect to a single output?

Hey correction here ... i'm using flat file as my source

Thanks in Advance,

Suresh N

It would help if you could provide a more explicit example of the type of logic you're hoping to implement, but here is a response based on my best guess at what you're trying to accomplish.

FIrst, start with the Derived Column transformation in your data flow: http://msdn2.microsoft.com/en-us/library/ms141069.aspx. This transform is the tool of choice for adding new columns - including new columns based on conditional logic and the values in existing columns - to your data flow.

Next, build an expression using the SSIS conditional operator to implement the If Then Else logic you need: http://msdn2.microsoft.com/en-us/library/ms141680.aspx.

You can also use the Script Transformation to perform more complex If Then Else logic in the data flow, but I personally try to avoid this if I can, as it makes your packages more difficult to maintain.

Please let us know if this gives you what you need.

|||

Thanks for reply Matthew.

I'm not able to do. Still needed help.

I have a flat file as a source, for each column i need to detect for NULL values. If it is NULL then i need to populate "99" Else Value.

I'm trying the same in Derived column transformation, not succeeded.

Do SSIS have something where i could write If Then Else ?

thanks..

Suresh N

|||

Suresh,

You can use a derived column transformation in the data flow with an conditional expression like

ISNULL(column1) ? 99 : column1

http://msdn2.microsoft.com/en-us/library/ms137538.aspx

|||

Suresh N wrote:

Thanks for reply Matthew.

I'm not able to do. Still needed help.

I have a flat file as a source, for each column i need to detect for NULL values. If it is NULL then i need to populate "99" Else Value.

I'm trying the same in Derived column transformation, not succeeded.

Do SSIS have something where i could write If Then Else ?

thanks..

Suresh N

This is exactly what the Derived Column transform is designed to do. Can you please post some specific information about what you are doing and what results you're seeing. There's not a lot of helpful information in your post to assist in troubleshooting.

|||

Hi Rafael,

Thanks much for your answer.

This has made my job done.

Regards,

Suresh N

|||

If you have to do this for several files accross a couple of packages then this when I think you should consider a custom transform. Faster development and maintenance as well as the ability to control custom business rules in a single (external to packages) assembly. The use of 99 in a local business rule I believe.

Wednesday, March 21, 2012

How do I hide zeros w/o a conditional stmt

I need a way to format fields without having to write a conditional statement
based on each textbox's value. I'm dealing with hundreds of fields.
Something like a HideZeros setting on the field. Any help would be
appreciatedWhat I do is change the Format property of each textbox to a custom value:
#,##0.0;(#,##0.0);-
the 1st group is how to display positive values;
the 2nd is for negatives;
and the 3rd is for zeroes (I am just displaying a dash here).
good luck,
Greg
"Blake Gremillion" <BlakeGremillion@.discussions.microsoft.com> wrote in
message news:64AAF2A7-F92B-4E91-8F96-3A9AAB2088FC@.microsoft.com...
>I need a way to format fields without having to write a conditional
>statement
> based on each textbox's value. I'm dealing with hundreds of fields.
> Something like a HideZeros setting on the field. Any help would be
> appreciated|||Thanks!
Worked great. Any idea on how to use that with a Percentage field.
"Blake Gremillion" wrote:
> I need a way to format fields without having to write a conditional statement
> based on each textbox's value. I'm dealing with hundreds of fields.
> Something like a HideZeros setting on the field. Any help would be
> appreciated|||I would try custom again and this time use:
0.0%;(0.0%);-
I pesonally use custom with percentages anyways and use
P1
to get just one decimal place. I think the standard "percentage" option,
gives you two. Of course neither hides zeroes. ;(
Greg
"Blake Gremillion" <BlakeGremillion@.discussions.microsoft.com> wrote in
message news:0B62BEDB-123A-4B5A-B363-ACAF9759425C@.microsoft.com...
> Thanks!
> Worked great. Any idea on how to use that with a Percentage field.
>
>
> "Blake Gremillion" wrote:
>> I need a way to format fields without having to write a conditional
>> statement
>> based on each textbox's value. I'm dealing with hundreds of fields.
>> Something like a HideZeros setting on the field. Any help would be
>> appreciated|||Yeah, I think that's what I'll have to do instead of using the Px format.
Thanks Again!
"Greg Burns" wrote:
> I would try custom again and this time use:
> 0.0%;(0.0%);-
> I pesonally use custom with percentages anyways and use
> P1
> to get just one decimal place. I think the standard "percentage" option,
> gives you two. Of course neither hides zeroes. ;(
> Greg
>
> "Blake Gremillion" <BlakeGremillion@.discussions.microsoft.com> wrote in
> message news:0B62BEDB-123A-4B5A-B363-ACAF9759425C@.microsoft.com...
> > Thanks!
> >
> > Worked great. Any idea on how to use that with a Percentage field.
> >
> >
> >
> >
> > "Blake Gremillion" wrote:
> >
> >> I need a way to format fields without having to write a conditional
> >> statement
> >> based on each textbox's value. I'm dealing with hundreds of fields.
> >> Something like a HideZeros setting on the field. Any help would be
> >> appreciated
>
>

How do I get unique rows based on studentID

I am a beginner at SQL so thanks ahead of time....

How do I get unique rows based on studentID? Distinct and group by don't seem to work

DESIRED RESULTS

StudentID First Name Last Name Other Columns....................................
634565491 MARINA BALDERAZ
640484566 TERE BALDERAZ


CURRENT SQL AND RESULTS....

SELECT ClassRosterRecID, StudentDataRecID, StudentDataKey, StudentID, FirstName, LastName, CurrentGrade, Gender, Ethnicity, EconDisadvantaged, TitleI, Migrant, LEP, Bilingual, ESL, SpecialEducation, GiftedTalented, AtRisk, CareerTech, Dyslexia, LastName + ', ' + FirstName AS LastNameFirstName, EconDisadvantagedSort, TitleISort, MigrantSort, LEPSort, BilingualSort, ESLSort, SpecialEducationSort, GiftedTalentedSort, AtRiskSort, CareerTechSort, DyslexiaSort, DistrictID, CampusID FROM vClassDemographicsDetail WHERE (DistrictID = '057910') AND (CampusID = '057910101') AND (LastName LIKE '%BALDERAZ%')

StudentID First Name Last Name Other Columns....................................
634565491 MARINA BALDERAZ
634565491 MARINA BALDERAZ
634565491 MARINA BALDERAZ
640484566 TERE BALDERAZ
640484566 TERE BALDERAZ
640484566 TERE BALDERAZ

craigbtx:

How do I get unique rows based on studentID? Distinct and group by don't seem to work

GROUP BY should work, just remember to add some aggregation function on the columns not in the GROUP BY list. Try something like:

SELECT max(ClassRosterRecID), max(StudentDataRecID), max(StudentDataKey), StudentID, FirstName,
LastName, max(CurrentGrade), max(Gender), max(Ethnicity), max(EconDisadvantaged), max(TitleI), max(Migrant), max(LEP), max(Bilingual), max(ESL), max(SpecialEducation), max(GiftedTalented), max(AtRisk), max(CareerTech), max(Dyslexia), LastName + ', ' + FirstName AS LastNameFirstName, max(EconDisadvantagedSort), max(TitleISort), max(MigrantSort), max(LEPSort), max(BilingualSort), max(ESLSort), max(SpecialEducationSort), max(GiftedTalentedSort), max(AtRiskSort), max(CareerTechSort), max(DyslexiaSort), max(DistrictID), max(CampusID )
FROM vClassDemographicsDetail
WHERE (DistrictID = '057910') AND (CampusID = '057910101') AND (LastName LIKE '%BALDERAZ%')
GROUP BY StudentID, [FirstName],[LastName]

Friday, February 24, 2012

How do I dynamically set the MultiValue property for 1 parameter based on another?

I am trying to set the property of 1 parameter based on the results of another parameter.

For example:

Parameters: PA and PB

If the user selects All or multiple values for PA

Then PB should not be MultiValue

Otherwise PB should be MultiValue

Does anyone have any suggestions?

Thanks

You could make PB MulitValue always, but have it's dataset filtered based on the PA parameter values. You just have to make sure PA comes first in your parameters list.

Hope that helps.