Monday, March 26, 2012
how to change permission via t-sql
I have a database that has about 50 tables. I have a user group assigned
to the database. I want them to be able to insert/update but not delete. The
only way I have seen is to go into the table permissions and change the
permissions. Is there an easier way via t-sql? Thanks in advance.
JakeRun this, verify that the output will do what you want and then execute the
output:
SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
--
Keith
"Jake" <rondican@.hotmail.com> wrote in message
news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I have a database that has about 50 tables. I have a user group
assigned
> to the database. I want them to be able to insert/update but not delete.
The
> only way I have seen is to go into the table permissions and change the
> permissions. Is there an easier way via t-sql? Thanks in advance.
> Jake
>|||Keith,
Thanks very much for the info
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
news:efMdMqAoEHA.2588@.TK2MSFTNGP12.phx.gbl...
> Run this, verify that the output will do what you want and then execute
the
> output:
> SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
> INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
> --
> Keith
>
> "Jake" <rondican@.hotmail.com> wrote in message
> news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> > Hello,
> >
> > I have a database that has about 50 tables. I have a user group
> assigned
> > to the database. I want them to be able to insert/update but not delete.
> The
> > only way I have seen is to go into the table permissions and change the
> > permissions. Is there an easier way via t-sql? Thanks in advance.
> >
> > Jake
> >
> >
>
how to change permission via t-sql
I have a database that has about 50 tables. I have a user group assigned
to the database. I want them to be able to insert/update but not delete. The
only way I have seen is to go into the table permissions and change the
permissions. Is there an easier way via t-sql? Thanks in advance.
Jake
Run this, verify that the output will do what you want and then execute the
output:
SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
Keith
"Jake" <rondican@.hotmail.com> wrote in message
news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I have a database that has about 50 tables. I have a user group
assigned
> to the database. I want them to be able to insert/update but not delete.
The
> only way I have seen is to go into the table permissions and change the
> permissions. Is there an easier way via t-sql? Thanks in advance.
> Jake
>
|||Keith,
Thanks very much for the info
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message
news:efMdMqAoEHA.2588@.TK2MSFTNGP12.phx.gbl...
> Run this, verify that the output will do what you want and then execute
the
> output:
> SELECT 'GRANT INSERT, UPDATE ON ' + TABLE_NAME + ' TO YourUserGroup' FROM
> INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'base table'
> --
> Keith
>
> "Jake" <rondican@.hotmail.com> wrote in message
> news:uyD6ueAoEHA.1456@.TK2MSFTNGP10.phx.gbl...
> assigned
> The
>
sql
Monday, March 12, 2012
How to callapse rows together
I'm need to collaspe a few rows together and output one row per group. The rows come from a flat file and are already sorted by orderid. Basically these are transactions with just the changed fields in them all unchanged fields are null (blank). They need to collapsed down to show the final state of all changed fields per order. Obviously the aggregate transform won't work in this situation since the goal is to collaspe instead of aggregate. In a language, I would normally buffer the previous row and apply the logic as needed until the orderid changed and then write out the new row. Then input file has millions of rows so I also didn't want to cursor through it updating individual rows in a table.
Example:
Orderid StatusCd OrderDt OrdrAmt
1 A 01/01/06 10
1 B
2 X 02/02/06 20
3 03/03/06 30
3 03/04/06
Collapse as
1 B 01/01/06 10
2 X 02/02/06 20
3 03/04/06
Danny,
The logic that you say you would apply in a programming language can be applied in exactly the same in SSIS by using a script component. I recommend you take a look at building an asynchronous script component.
-Jamie
Friday, February 24, 2012
How to calculate distinct count per group?
how many distinctive customers we have in each of them:
I placed this formula in group footer
:=countDistinct(Fields!Customers.Value,"Department")
but it shows me total number of customers in each row.
OlegHope u followed the following procedure:
1. Group on Department.
2. CountDistinct(Fields!Customers.Value, "<group name>")
NOTE: <group name> is the name of the group not the field on which grouping
is done.
Regards,
Saras