Wednesday, March 7, 2012

q; the owner of the table

Hello,
I need to user full name for the table as seen below.
SELECT @.RowCount = COUNT(*)
FROM T1 c INNER JOIN [MyInstance].MyDB.dbo.T2 b ON c.T1_ID=b.T2_ID
T2 may be re-created by different users, how can I get this working for all
users if the creator is not dbo?JIM
You will have to identify an user and then creating dynamic sql if I
understood you properly.
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:295BC91E-3F82-4EB8-BFAF-71DCC335FAC5@.microsoft.com...
> Hello,
> I need to user full name for the table as seen below.
> SELECT @.RowCount = COUNT(*)
> FROM T1 c INNER JOIN [MyInstance].MyDB.dbo.T2 b ON c.T1_ID=b.T2_ID
> T2 may be re-created by different users, how can I get this working for
> all
> users if the creator is not dbo?
>|||Thanks for the reply, I am trying to select the data whoever creates it, if
the owner is not dbo, my query is not working, owner may be many users since
people drop it an recreate it from time to time.
"Uri Dimant" wrote:
> JIM
> You will have to identify an user and then creating dynamic sql if I
> understood you properly.
>
>
>
> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
> news:295BC91E-3F82-4EB8-BFAF-71DCC335FAC5@.microsoft.com...
> > Hello,
> > I need to user full name for the table as seen below.
> >
> > SELECT @.RowCount = COUNT(*)
> > FROM T1 c INNER JOIN [MyInstance].MyDB.dbo.T2 b ON c.T1_ID=b.T2_ID
> >
> > T2 may be re-created by different users, how can I get this working for
> > all
> > users if the creator is not dbo?
> >
>
>|||JIM
So specify
CREATE TABLE user.TableName (col INT)
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:8EA06ACD-F357-4434-92B2-25B5A47006B3@.microsoft.com...
> Thanks for the reply, I am trying to select the data whoever creates it,
> if
> the owner is not dbo, my query is not working, owner may be many users
> since
> people drop it an recreate it from time to time.
> "Uri Dimant" wrote:
>> JIM
>> You will have to identify an user and then creating dynamic sql if I
>> understood you properly.
>>
>>
>>
>> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
>> news:295BC91E-3F82-4EB8-BFAF-71DCC335FAC5@.microsoft.com...
>> > Hello,
>> > I need to user full name for the table as seen below.
>> >
>> > SELECT @.RowCount = COUNT(*)
>> > FROM T1 c INNER JOIN [MyInstance].MyDB.dbo.T2 b ON c.T1_ID=b.T2_ID
>> >
>> > T2 may be re-created by different users, how can I get this working for
>> > all
>> > users if the creator is not dbo?
>> >
>>|||JIM.H. wrote:
> Thanks for the reply, I am trying to select the data whoever creates it, if
> the owner is not dbo, my query is not working, owner may be many users since
> people drop it an recreate it from time to time.
> "Uri Dimant" wrote:
Having a table that is repeatedly dropped/created by your users seems
like a bad idea. Why not create a permanent table, owned by dbo, and
have your users TRUNCATE it instead of dropping/creating it? Or better
yet, explain why the need to drop/create exists, and perhaps we can
offer a better idea?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:8EA06ACD-F357-4434-92B2-25B5A47006B3@.microsoft.com...
> Thanks for the reply, I am trying to select the data whoever creates it,
> if
> the owner is not dbo, my query is not working, owner may be many users
> since
> people drop it an recreate it from time to time.
> "Uri Dimant" wrote:
>> JIM
>> You will have to identify an user and then creating dynamic sql if I
>> understood you properly.
>>
>>
>>
>> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
>> news:295BC91E-3F82-4EB8-BFAF-71DCC335FAC5@.microsoft.com...
>> > Hello,
>> > I need to user full name for the table as seen below.
>> >
>> > SELECT @.RowCount = COUNT(*)
>> > FROM T1 c INNER JOIN [MyInstance].MyDB.dbo.T2 b ON c.T1_ID=b.T2_ID
>> >
>> > T2 may be re-created by different users, how can I get this working for
>> > all
>> > users if the creator is not dbo?
>> >
>>|||Thanks for the reply. I agree however that is the part of the code I do not
have control over, I just need to figure out a way select it based on the
different owner.
"Tracy McKibben" wrote:
> JIM.H. wrote:
> > Thanks for the reply, I am trying to select the data whoever creates it, if
> > the owner is not dbo, my query is not working, owner may be many users since
> > people drop it an recreate it from time to time.
> >
> > "Uri Dimant" wrote:
> Having a table that is repeatedly dropped/created by your users seems
> like a bad idea. Why not create a permanent table, owned by dbo, and
> have your users TRUNCATE it instead of dropping/creating it? Or better
> yet, explain why the need to drop/create exists, and perhaps we can
> offer a better idea?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>

No comments:

Post a Comment