Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to find the table name in specified query

Author  Topic 

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-12-28 : 05:28:47
Hi to all ,

i am storing query's witch are used in ssms through application. I want to know which are tables used in those queries through application. My problem is i can't see those queries but i want to know which tables are used in those queries.

thanks



Manju

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-12-28 : 06:32:23
storing queries? PLEASE say you mean as a stored procedure and not a varchar(max) column.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-12-28 : 06:58:51
Hi Donatwork,

yes i am storing queris in a table, not a stored procedure and please dont tell me about profiler i dont want to use that.

Thanks

Manju
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-28 : 07:21:16
why do you need to store queries themselves as values in a table. thats certainly not a good approach.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-12-28 : 07:29:47
Hi Visakh,

client want to see witch query's are useing or used in ssms.

so for that purpose i am storing those query's witch are used in ssms.

Thanks


Manju
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-12-28 : 10:15:03
quote:
Originally posted by manju3606

Hi Donatwork,

yes i am storing queris in a table, not a stored procedure and please dont tell me about profiler i dont want to use that.

Thanks

Manju


If you do not want to use the correct tool for the job, then i cannot help you.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-28 : 11:39:57
quote:
Originally posted by manju3606

Hi Visakh,

client want to see witch query's are useing or used in ssms.

so for that purpose i am storing those query's witch are used in ssms.

Thanks


Manju


why should you store it in table?
FOr that you can make use of dmvs or profiler traces

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-28 : 12:01:02
which

in any case...TELL Your client you'll be glad to allow ONLY Sproc access to the data...and ask them for a BRD

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-12-29 : 00:38:25
quote:
Originally posted by visakh16

quote:
Originally posted by manju3606

Hi Visakh,

client want to see witch query's are useing or used in ssms.

so for that purpose i am storing those query's witch are used in ssms.

Thanks


Manju


why should you store it in table?
FOr that you can make use of dmvs or profiler traces

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




client don't want to use profiler,and from Dmvs i cant get all data, in some case like dmvs have some time of pired to store data and if server restart then i cat get old data from dmvs and etc.

Thanks


Manju
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-29 : 00:48:44
hmm...ok
what will these queries be used for? just analysing or they'll try executing it too?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

manju3606
Yak Posting Veteran

78 Posts

Posted - 2011-12-29 : 01:07:56
They want to analys these queries and now they want most used data in the database so for that they want to cxecut these query and i told them thats not a good idea but they are not listening me could you please tell me any way to get most used data and not used data from database

Thanks

Manju
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-12-29 : 06:42:40
quote:
Originally posted by manju3606

client don't want to use profiler,and from Dmvs i cant get all data, in some case like dmvs have some time of pired to store data and if server restart then i cat get old data from dmvs and etc.

Thanks


Manju


Then the client does not understand what they want.


http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-29 : 09:18:51
I'm sorry...but why does all the insanity
Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -