Showing posts with label fields. Show all posts
Showing posts with label fields. Show all posts

Monday, March 26, 2012

Grant insert, but only allow entering vals in some fields

I have a table with 3 fields:
val1
val2
val3
Is there a way using a role to allow users to create a new record in
the table, but only allowing them to populate the val1 field during the
insert? They should not be allowed to put data in fields val2 and val3
during the insert and they should only be allowed to modify the val1
field.
Thanks!
Chris(cbtechlists@.gmail.com) writes:
> I have a table with 3 fields:
> val1
> val2
> val3
> Is there a way using a role to allow users to create a new record in
> the table, but only allowing them to populate the val1 field during the
> insert? They should not be allowed to put data in fields val2 and val3
> during the insert and they should only be allowed to modify the val1
> field.
You could a create view that exposes the permitted column and let the
users insert into that view rather than directly to the table. Or you
could expose all columns in the table, and have an INSTEAD OF trigger
ignores the non-permitted columns.
... or you could use stored procedures.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Wednesday, March 21, 2012

Grabbing a calculated field for a new calculation

I'm going to try and explain this as best as I can :)
I have calculated fields that has the following expressions - I've
named each textbox hoping that I could grab them in the expression but
I have no idea how':
1. totalMarket: =iif(sum(Fields!Wins.Value) = 0, 0, sum( Fields!
Wins.Value) + iif(sum(Fields!Pending.Value) = 0, 0, sum(Fields!
Pending.Value))) - iif(sum(Fields!Losses.Value) = 0, 0, sum(Fields!
Losses.Value))
2. remainingSales = =iif(Sum(Fields!Pending.Value)=0, 0, Sum(Fields!
Pending.Value))
I need the next text box (marketPercent) to do the following...
totalMarket - remainingSales / totalMarket
I used all the expression above to make it work - but there has to be
an easier way.. I tried using..
=iif(Sum(ReportItem!totalMarket.Value)) ... etc but that syntax did
not work... does anyone know how to grab the name of the textbox in
an expression?
ps - this is not a header or a footer - it's in the actual form
Thanks in advance!
LisaOn Jun 6, 10:38 am, peashoe <peas...@.yahoo.com> wrote:
> I'm going to try and explain this as best as I can :)
> I have calculated fields that has the following expressions - I've
> named each textbox hoping that I could grab them in the expression but
> I have no idea how':
> 1. totalMarket: =iif(sum(Fields!Wins.Value) = 0, 0, sum( Fields!
> Wins.Value) + iif(sum(Fields!Pending.Value) = 0, 0, sum(Fields!
> Pending.Value))) - iif(sum(Fields!Losses.Value) = 0, 0, sum(Fields!
> Losses.Value))
> 2. remainingSales = =iif(Sum(Fields!Pending.Value)=0, 0, Sum(Fields!
> Pending.Value))
> I need the next text box (marketPercent) to do the following...
> totalMarket - remainingSales / totalMarket
> I used all the expression above to make it work - but there has to be
> an easier way.. I tried using..
> =iif(Sum(ReportItem!totalMarket.Value)) ... etc but that syntax did
> not work... does anyone know how to grab the name of the textbox in
> an expression?
> ps - this is not a header or a footer - it's in the actual form
> Thanks in advance!
> Lisa
As far as I know, referencing the textbox control by an alias is not
possible. Referencing the textbox by the expression used is most
likely the only way to reference it. Sorry that I could not be of
greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultantsql

Monday, March 19, 2012

Goofy problem

Hi All,
When I use the "between" statement
in the query analyzer in MRS, it will not poplulate the data fields.
when I remove the between statement, it runs fine. The parameters in
the
between statement are correct, and I tried different paramenters such
as
a date between 2002 and 2007, which I know is in the db same problem.
I have service packed SQL and VizStudio no help.
Thanks,
>Scott
here's a snippette:
No results using this.
Where Year >= 2006
And Month BETWEEN @.BEGINDATE AND @.ENDDATE
Group by etc......you need to convert your begin and enddate parameters to Months for this to
work, you can use MONTH(@.BeginDate) to do this.
"scott" <dunnscott@.gmail.com> wrote in message
news:1185297699.337926.89340@.57g2000hsv.googlegroups.com...
> Hi All,
> When I use the "between" statement
> in the query analyzer in MRS, it will not poplulate the data fields.
> when I remove the between statement, it runs fine. The parameters in
> the
> between statement are correct, and I tried different paramenters such
> as
> a date between 2002 and 2007, which I know is in the db same problem.
> I have service packed SQL and VizStudio no help.
> Thanks,
>>Scott
> here's a snippette:
> No results using this.
> Where Year >= 2006
> And Month BETWEEN @.BEGINDATE AND @.ENDDATE
> Group by etc......
>

Friday, February 24, 2012

Global Summation

Hello,

I'm having one small issue. I have 13 subreports, and in these subreports, I have a formula that adds up certain data fields. However, I need a formula in which it adds up all these fields globally but have been unsuccessful to do so.

If anybody could shed some light on this, that would be fantastic.

Thanks,
Adrianyou may look at 'shared' data level.


shared numbervar myvar;

it keeps value of variable in other sub report.

Global expression apply to all fields in report

Hi All,

I got a situation that need to write a expression for doing if the value is negtive then display () around this value, and this expression should apply to 30 fields in my report. so i just wonder is that any way that i can create this expression as global variable , then i can use this expression in each field, instead of i write IIF function in every field expression area.

Any helps are appreciated.

Cheers

Nick

Moved to SSRS forum....(from SSIS)|||

Hi Nick,

You can declare a public variable in the Custom code section of the SSRS reports. The syntax for this variable declaration should be VB. Once declared, it can be used in any part of the report by referring to the field as Code."Variable Name". eg. Code.IntCounter.

Regards,

Pradeep

|||

Yeah, i did this way, and it works.. Thanks mate

But i have a little question, it always hightlight the global variable name and indicate it is not declared object in expression area. even through it still works.

Cheers

Nick

Sunday, February 19, 2012

Global expression apply to all fields in report

Hi All,

I got a situation that need to write a expression for doing if the value is negtive then display () around this value, and this expression should apply to 30 fields in my report. so i just wonder is that any way that i can create this expression as global variable , then i can use this expression in each field, instead of i write IIF function in every field expression area.

Any helps are appreciated.

Cheers

Nick

Moved to SSRS forum....(from SSIS)|||

Hi Nick,

You can declare a public variable in the Custom code section of the SSRS reports. The syntax for this variable declaration should be VB. Once declared, it can be used in any part of the report by referring to the field as Code."Variable Name". eg. Code.IntCounter.

Regards,

Pradeep

|||

Yeah, i did this way, and it works.. Thanks mate

But i have a little question, it always hightlight the global variable name and indicate it is not declared object in expression area. even through it still works.

Cheers

Nick