Showing posts with label checking. Show all posts
Showing posts with label checking. Show all posts

Monday, March 26, 2012

Grant login permission on tables

Hi,
In my SQL Server 2000, how do I grant a login account permission for tables
in a particular database, using script, not by checking the checkboxes.
There are many tables in that database, and I am thinking using script, it
will be faster.
Thanks for help.
JasonIf the user already exists on the database try some of these
grant select on mytable to user
grant insert on mytable to user
grant update on mytable to user
grant delete on mytable to user
grant select, insert, update, delete on mytable to user
grant all on mytable to user
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Jason Huang" wrote:
> Hi,
> In my SQL Server 2000, how do I grant a login account permission for tables
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>|||Hi Jason,
Try this out:
select 'grant Select,Insert,Delete,Update on ' +name+ ' to [Username in
database]' from sysobjects where xtype='U'
Make sure user is already there in database.
Manu
"Jason Huang" wrote:
> Hi,
> In my SQL Server 2000, how do I grant a login account permission for tables
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>

Grant login permission on tables

Hi,
In my SQL Server 2000, how do I grant a login account permission for tables
in a particular database, using script, not by checking the checkboxes.
There are many tables in that database, and I am thinking using script, it
will be faster.
Thanks for help.
Jason
If the user already exists on the database try some of these
grant select on mytable to user
grant insert on mytable to user
grant update on mytable to user
grant delete on mytable to user
grant select, insert, update, delete on mytable to user
grant all on mytable to user
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Jason Huang" wrote:

> Hi,
> In my SQL Server 2000, how do I grant a login account permission for tables
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>
|||Hi Jason,
Try this out:
select 'grant Select,Insert,Delete,Update on ' +name+ ' to [Username in
database]' from sysobjects where xtype='U'
Make sure user is already there in database.
Manu
"Jason Huang" wrote:

> Hi,
> In my SQL Server 2000, how do I grant a login account permission for tables
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>

Grant login permission on tables

Hi,
In my SQL Server 2000, how do I grant a login account permission for tables
in a particular database, using script, not by checking the checkboxes.
There are many tables in that database, and I am thinking using script, it
will be faster.
Thanks for help.
JasonIf the user already exists on the database try some of these
grant select on mytable to user
grant insert on mytable to user
grant update on mytable to user
grant delete on mytable to user
grant select, insert, update, delete on mytable to user
grant all on mytable to user
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Jason Huang" wrote:

> Hi,
> In my SQL Server 2000, how do I grant a login account permission for table
s
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>|||Hi Jason,
Try this out:
select 'grant Select,Insert,Delete,Update on ' +name+ ' to [Username in
database]' from sysobjects where xtype='U'
Make sure user is already there in database.
Manu
"Jason Huang" wrote:

> Hi,
> In my SQL Server 2000, how do I grant a login account permission for table
s
> in a particular database, using script, not by checking the checkboxes.
> There are many tables in that database, and I am thinking using script, it
> will be faster.
> Thanks for help.
>
> Jason
>
>

Wednesday, March 21, 2012

Grabbing first record rather than the record I am trying to find.

I tried checking to see if the point at which the reader was, that if it was the record I am looking for to go ahead and add the table data to a label. But for some reason it's only taking the first record in the database and not the one I thought I was at.

[CODE] public void UpdateMaleHistLbl()
{
SqlConnection conn = new SqlConnection("Server=localhost\\SqlExpress;Database=MyFamTree;" + "Integrated Security=True");
SqlCommand comm = new SqlCommand("SELECT * FROM FatherHistTable, MotherHistTable, UsersTable WHERE UsersTable.UserName = @.usrnmeLbl ", conn);
comm.Parameters.AddWithValue("@.usrnmeLbl", usrnmeLbl.Text);
conn.Open();
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
string usr = reader["username"].ToString();
usr = usr.TrimEnd();
string pss = reader["password"].ToString();
pss = pss.TrimEnd();
if (usrnmeLbl.Text == usr)
{
if (hiddenpassLbl.Text == pss)
{
maleHistLbl.Text = reader["GG_Grandfather"] + " > ";
maleHistLbl.Text += reader["G_Grandfather"] + " > ";
maleHistLbl.Text += reader["Grandfather"] + " > ";
maleHistLbl.Text += reader["Father"] + " > ";
maleHistLbl.Text += reader["Son"] + " > ";
maleHistLbl.Text += reader["Grandson"] + " > ";
maleHistLbl.Text += reader["G_Grandson"] + " > ";
maleHistLbl.Text += reader["GG_Grandson"] + "<br /><br />";
}
}
break; //exit out of the loop since user found
}
reader.Close();
conn.Close();
}
}[/CODE]

Thanks in advanceIt was the break statement taking me out too early.sql