Home All Groups Group Topic Archive Search About

Little Lock Symbols

Author
15 Jan 2007 6:15 PM
Candyman
WE are new to SQL Server 2005.  My team memebers and I have the same login-in
as a group. One member developed some stored procedure code that I am trying
to review , but there are thse little lock symbols on the file icon.  how can
I see the file?

Author
15 Jan 2007 6:20 PM
Aaron Bertrand [SQL Server MVP]
Do you mean when you open the file in Management Studio, the tab at the top
has a lock icon?  This means the file is read-only, possibly because it is
checked into source control.  If this is not what you are talking about,
then you can explain (a) where you see the lock, and (b) what it means that
you can't "see" the file?

A

Show quote
"Candyman" <Candy***@discussions.microsoft.com> wrote in message
news:F8A96B55-7ED2-4913-94EF-FB215804AE17@microsoft.com...
> WE are new to SQL Server 2005.  My team memebers and I have the same
> login-in
> as a group. One member developed some stored procedure code that I am
> trying
> to review , but there are thse little lock symbols on the file icon.  how
> can
> I see the file?
Author
15 Jan 2007 6:45 PM
Candyman
WE are in Management Studio.  On the left hand side is the Obkect Explorer,
We have many listings under databases. The tree structure looks like
Databases\db_ReportSource\Programmability\Stored Procedures. . . Then there
is a file dbo.SQL_myquery listed and the adjacent icon looks like a light
blue piece of paper  with a darker blue stripe at the top. Then there is a
little yelow lock on the right lower corner of the icon. My team mate can
right click on the file and see a Modify option to show me the code.  That
Modify option is greyed out to me. ( and four other procs he created.) How do
I see the code? Is there another way to get to it?

Show quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> Do you mean when you open the file in Management Studio, the tab at the top
> has a lock icon?  This means the file is read-only, possibly because it is
> checked into source control.  If this is not what you are talking about,
> then you can explain (a) where you see the lock, and (b) what it means that
> you can't "see" the file?
>
> A
>
> "Candyman" <Candy***@discussions.microsoft.com> wrote in message
> news:F8A96B55-7ED2-4913-94EF-FB215804AE17@microsoft.com...
> > WE are new to SQL Server 2005.  My team memebers and I have the same
> > login-in
> > as a group. One member developed some stored procedure code that I am
> > trying
> > to review , but there are thse little lock symbols on the file icon.  how
> > can
> > I see the file?
>
>
>
Author
15 Jan 2007 6:58 PM
Aaron Bertrand [SQL Server MVP]
If you just want to see it and not modify it, then:

(1)  Right-click the database name and select new query

(2) Make sure you are in Results to Text (Ctrl+T)

(3) Type:

    EXEC sp_helptext 'SQL_myquery';

(4) Hit F5 (or the Execute button on the toolbar)





Show quote
"Candyman" <Candy***@discussions.microsoft.com> wrote in message
news:119BA461-C65C-4755-83CA-E7EF1C4CAE3B@microsoft.com...
> WE are in Management Studio.  On the left hand side is the Obkect
> Explorer,
> We have many listings under databases. The tree structure looks like
> Databases\db_ReportSource\Programmability\Stored Procedures. . . Then
> there
> is a file dbo.SQL_myquery listed and the adjacent icon looks like a light
> blue piece of paper  with a darker blue stripe at the top. Then there is a
> little yelow lock on the right lower corner of the icon. My team mate can
> right click on the file and see a Modify option to show me the code.  That
> Modify option is greyed out to me. ( and four other procs he created.) How
> do
> I see the code? Is there another way to get to it?
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>
>> Do you mean when you open the file in Management Studio, the tab at the
>> top
>> has a lock icon?  This means the file is read-only, possibly because it
>> is
>> checked into source control.  If this is not what you are talking about,
>> then you can explain (a) where you see the lock, and (b) what it means
>> that
>> you can't "see" the file?
>>
>> A
>>
>> "Candyman" <Candy***@discussions.microsoft.com> wrote in message
>> news:F8A96B55-7ED2-4913-94EF-FB215804AE17@microsoft.com...
>> > WE are new to SQL Server 2005.  My team memebers and I have the same
>> > login-in
>> > as a group. One member developed some stored procedure code that I am
>> > trying
>> > to review , but there are thse little lock symbols on the file icon.
>> > how
>> > can
>> > I see the file?
>>
>>
>>
Author
15 Jan 2007 8:46 PM
Candyman
if I 'check (green check)' it, the programs returns: "query excecuted
successfully".

Then when I try to run as suggested the command errors out saying "There is
no text for object 'SQL_myquery'"

Could the file actuallly be residing on the other users machine and not in
SQL Server? or network?

Show quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> If you just want to see it and not modify it, then:
>
> (1)  Right-click the database name and select new query
>
> (2) Make sure you are in Results to Text (Ctrl+T)
>
> (3) Type:
>
>     EXEC sp_helptext 'SQL_myquery';
>
> (4) Hit F5 (or the Execute button on the toolbar)
>
>
>
>
>
> "Candyman" <Candy***@discussions.microsoft.com> wrote in message
> news:119BA461-C65C-4755-83CA-E7EF1C4CAE3B@microsoft.com...
> > WE are in Management Studio.  On the left hand side is the Obkect
> > Explorer,
> > We have many listings under databases. The tree structure looks like
> > Databases\db_ReportSource\Programmability\Stored Procedures. . . Then
> > there
> > is a file dbo.SQL_myquery listed and the adjacent icon looks like a light
> > blue piece of paper  with a darker blue stripe at the top. Then there is a
> > little yelow lock on the right lower corner of the icon. My team mate can
> > right click on the file and see a Modify option to show me the code.  That
> > Modify option is greyed out to me. ( and four other procs he created.) How
> > do
> > I see the code? Is there another way to get to it?
> >
> > "Aaron Bertrand [SQL Server MVP]" wrote:
> >
> >> Do you mean when you open the file in Management Studio, the tab at the
> >> top
> >> has a lock icon?  This means the file is read-only, possibly because it
> >> is
> >> checked into source control.  If this is not what you are talking about,
> >> then you can explain (a) where you see the lock, and (b) what it means
> >> that
> >> you can't "see" the file?
> >>
> >> A
> >>
> >> "Candyman" <Candy***@discussions.microsoft.com> wrote in message
> >> news:F8A96B55-7ED2-4913-94EF-FB215804AE17@microsoft.com...
> >> > WE are new to SQL Server 2005.  My team memebers and I have the same
> >> > login-in
> >> > as a group. One member developed some stored procedure code that I am
> >> > trying
> >> > to review , but there are thse little lock symbols on the file icon.
> >> > how
> >> > can
> >> > I see the file?
> >>
> >>
> >>
>
>
>
Author
15 Jan 2007 11:05 PM
Aaron Bertrand [SQL Server MVP]
> if I 'check (green check)' it, the programs returns: "query excecuted
> successfully".

Yes, if you hold your mouse over the green check you decided to click, you
will see that means "parse" (syntax check).  The success message means that
the command didn't have any syntax errors.

> Then when I try to run as suggested the command errors out saying "There
> is
> no text for object 'SQL_myquery'"

Are you sure your query is running in the correct database?  When you
right-clicked "the database" was it db_ReportSource, or some other database?
Are you sure you were in an Object Explorer context of the correct server?
What happens when you execute the following in a properly created New Query
window:

USE db_ReportSource;
GO
EXEC SQL_myquery;
GO
EXEC dbo.SQL_myquery;
GO

?

> Could the file actuallly be residing on the other users machine and not in
> SQL Server? or network?

No, from your earlier description, this is a stored procedure in a database.
There are many differences between a stored procedure in the database and a
file in the file system.  They are certainly not the same, and a file
somewhere on your network is certainly not going to magically appear under
the stored procedures node in object explorer.

A
Author
16 Jan 2007 6:11 PM
Candyman
The application asked me for some date parameters, which I enterd and
recieved results back so there is something there, but I still can't see the
original code.

Erland might have hit it on found the solution as the file properties do
seem to be encrypted.  This is something we will have to discuss withthe
group.  Thanks so much for your input and patience.

Show quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> > if I 'check (green check)' it, the programs returns: "query excecuted
> > successfully".
>
> Yes, if you hold your mouse over the green check you decided to click, you
> will see that means "parse" (syntax check).  The success message means that
> the command didn't have any syntax errors.
>
> > Then when I try to run as suggested the command errors out saying "There
> > is
> > no text for object 'SQL_myquery'"
>
> Are you sure your query is running in the correct database?  When you
> right-clicked "the database" was it db_ReportSource, or some other database?
> Are you sure you were in an Object Explorer context of the correct server?
> What happens when you execute the following in a properly created New Query
> window:
>
> USE db_ReportSource;
> GO
> EXEC SQL_myquery;
> GO
> EXEC dbo.SQL_myquery;
> GO
>
> ?
>
> > Could the file actuallly be residing on the other users machine and not in
> > SQL Server? or network?
>
> No, from your earlier description, this is a stored procedure in a database.
> There are many differences between a stored procedure in the database and a
> file in the file system.  They are certainly not the same, and a file
> somewhere on your network is certainly not going to magically appear under
> the stored procedures node in object explorer.
>
> A
>
>
>
Author
15 Jan 2007 11:10 PM
Erland Sommarskog
Candyman (Candy***@discussions.microsoft.com) writes:
> if I 'check (green check)' it, the programs returns: "query excecuted
> successfully".
>
> Then when I try to run as suggested the command errors out saying "There
> is no text for object 'SQL_myquery'"
>
> Could the file actuallly be residing on the other users machine and not in
> SQL Server? or network?

First of all, it is not a file. It's an object in a database, and there
should indeed be a file for it in the file system, or even better in
the version-control system. But if you co-worker just created the procedure
in a query window, and then closed the window without saving it, there is
no file at all. Just an object in a database.

Normally, though, stored procedures can be disassembled from the database
so you can edit them, which is popular in teams that don't believe in
files or version-control systems.

But this small lock indicates that you can't. There are two possible reasons
for this:
o  The procedure was created with the clause WITH ENCRYPTION.
o  It is a stored procedure created in a CLR language such as VB .Net or C#.

If you right-click the procedure and selecr Properties, you might be
able to deduce which of the cases it is. If there things like "Property
AnsiNullsStatus is not available..." it is a CLR stored procedure.

In either cases, you will have to ask your co-worker where he has the
source code.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
16 Jan 2007 6:13 PM
Candyman
BINGO!
Under properties in the Options section the file has Encrypted set to TRUE
and Replication set to FALSE also ( I guess which means I could not copy the
file which I tried to do also.)

We are baby new to this and I have to bring this up to the author of the
code and to our new “Weekly user group” . Both of which are out today, but
thank you for the info! This is helpful.

I will also suggest we start using Source Safe for version control.
Thanks!


Show quote
"Erland Sommarskog" wrote:

> Candyman (Candy***@discussions.microsoft.com) writes:
> > if I 'check (green check)' it, the programs returns: "query excecuted
> > successfully".
> >
> > Then when I try to run as suggested the command errors out saying "There
> > is no text for object 'SQL_myquery'"
> >
> > Could the file actuallly be residing on the other users machine and not in
> > SQL Server? or network?

> First of all, it is not a file. It's an object in a database, and there
> should indeed be a file for it in the file system, or even better in
> the version-control system. But if you co-worker just created the procedure
> in a query window, and then closed the window without saving it, there is
> no file at all. Just an object in a database.
>
> Normally, though, stored procedures can be disassembled from the database
> so you can edit them, which is popular in teams that don't believe in
> files or version-control systems.
>
> But this small lock indicates that you can't. There are two possible reasons
> for this:
> o  The procedure was created with the clause WITH ENCRYPTION.
> o  It is a stored procedure created in a CLR language such as VB .Net or C#.
>
> If you right-click the procedure and selecr Properties, you might be
> able to deduce which of the cases it is. If there things like "Property
> AnsiNullsStatus is not available..." it is a CLR stored procedure.
>
> In either cases, you will have to ask your co-worker where he has the
> source code.
>
> --
> Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
Author
16 Jan 2007 6:21 PM
Aaron Bertrand [SQL Server MVP]
> Under properties in the Options section the file has Encrypted set to TRUE
> and Replication set to FALSE also ( I guess which means I could not copy
> the
> file which I tried to do also.)

No, replication and copying a file are not the same thing.

A
Author
16 Jan 2007 6:28 PM
Candyman
Thank you.
I guess I have some 'homework'.  I know SQL Server is really powerful and I
am just really excited to fianlly work with it.

Show quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> > Under properties in the Options section the file has Encrypted set to TRUE
> > and Replication set to FALSE also ( I guess which means I could not copy
> > the
> > file which I tried to do also.)
>
> No, replication and copying a file are not the same thing.
>
> A
>
>
>
Author
16 Jan 2007 11:02 PM
Erland Sommarskog
Candyman (Candy***@discussions.microsoft.com) writes:
> Under properties in the Options section the file has Encrypted set to
> TRUE and Replication set to FALSE also ( I guess which means I could not
> copy the file which I tried to do also.)

Beware that Encrypted is true also for CLR procedures. That's why I
suggested that you should look at AnsiNulls. Unfortunately there
appears to be no clearcut way to see that the procedure is a CLR
procedure.

Replication procedures is a very special class of procedures that you
use when you use the replication feature in SQL Server to have data
copied in near-real-time to another database. It has nothing to do with
copying.

And, permit me to hammer this: it is not a file! It simply is not a file!
It is a object in a database. It is not a file!



--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
17 Jan 2007 12:10 AM
Candyman
I stand corrected. not a file! :)

Very Interesting. Then (he says with wide eyed, open minded couriosity) if
this is an object, can i see the code by looking at one of its properties?


Show quote
"Erland Sommarskog" wrote:

> Candyman (Candy***@discussions.microsoft.com) writes:
> > Under properties in the Options section the file has Encrypted set to
> > TRUE and Replication set to FALSE also ( I guess which means I could not
> > copy the file which I tried to do also.)
>
> Beware that Encrypted is true also for CLR procedures. That's why I
> suggested that you should look at AnsiNulls. Unfortunately there
> appears to be no clearcut way to see that the procedure is a CLR
> procedure.
>
> Replication procedures is a very special class of procedures that you
> use when you use the replication feature in SQL Server to have data
> copied in near-real-time to another database. It has nothing to do with
> copying.
>
> And, permit me to hammer this: it is not a file! It simply is not a file!
> It is a object in a database. It is not a file!
>
>
>
> --
> Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>
Author
17 Jan 2007 1:53 PM
Erland Sommarskog
Candyman (Candy***@discussions.microsoft.com) writes:
> Very Interesting. Then (he says with wide eyed, open minded couriosity) if
> this is an object, can i see the code by looking at one of its properties?

Call it disassembly.

The true case that the procedure code is stored as-is in SQL Server - as
long as you don't apply WITH ENCRYPTION, so the disassembly is very trivial.
Nevertheless the server is a place where something is deployed.

And note that the same does not apply to all objects. The source code for a
table is not stored in SQL Server. You can create scripts from your tables,
but they may not agree with the original source you fed to SQL Server.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button