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
 General SQL Server Forums
 New to SQL Server Administration
 Using @Prompt Question

Author  Topic 

mqh7
Yak Posting Veteran

58 Posts

Posted - 2012-08-17 : 11:52:11
All of the SQL stuff I do is for SCCM 2007. The report tool in SCCM 2007 is very weak compared to SQL Server Management Studio tool. But in the SCCM report tool it allows you to use @Prompt to ask for data.

Example:


select
rs.Name0 AS [PC Name],
ru.User_Name0 AS [Logon Name],
Full_User_Name0 AS [Full Name]
from v_R_System rs left outer join v_R_User ru on rs.User_Name0 = ru.User_Name0
where (rs.Name0 LIKE @PCName)

This, when run from the SCCM report tool, will prompt you for a PC Name, which you enter and then get your results.

But when entered into the SQL Studio tool it won't run and the @PCName is the error.

Can you use a prompt in the SQL Studio tool and if so how do you do it?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-17 : 12:13:16
nope you cant

SQL Studio is just a client tool and not a front end UI

you can make it into procedure and right click and execute it though from object explorer and it will prompt for value of parameters then

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

Go to Top of Page
   

- Advertisement -