(imported topic written by BenGJohn91)
How do I setup a property to run a SQL query on a db on an endpoint?
“select count(*) from…”
(imported topic written by BenGJohn91)
How do I setup a property to run a SQL query on a db on an endpoint?
“select count(*) from…”
(imported comment written by BenGJohn91)
I’m new to Relevence, how would I use the osql command? I tried the following, but I’m getting an error “This expression could not be parsed.”
osql -U “user” -P “password” -Q "select count(*) from
db
where …" > “c:\sqldbs.out”
line of file “c:\sqldbs.out”
I checked the endpoint and the sqldbs.out file is not even generated.
–
sthull
Hi Mike,
You would have to use a command line tool to query SQL, like osql:
osql -U sa -P pswd -Q “select name from sysdatabases” > sqldbs.out
Then use ‘lines of file “sqldbs.out”’ relevance to pull the info you want.
Regards,
Steve
(imported comment written by NoahSalzman)
osql is a command you would run from a Windows terminal. sqlcmd is the new hotness, apparently:
http://msdn.microsoft.com/en-us/library/ms162773.aspx
Get your Windows command set they way you want it… and then drop it into an Action Script. Sometimes it is as simple as preprending the Action Script command “waithidden” to your command, sometimes you have to make some modifications such as quoting the arguments. I probably should have linked here the first time:
(imported comment written by BenGJohn91)
Is there a way to run sqlcmd as part of the retrieved property script?
(imported comment written by JackCoates91)
Hi,
no, there is not. Because retrieved properties are evaluated frequently, they are designed to be passive gatherers of information. Active work needs to be done as an action, which lets you be much more in control about when the action is taken.
Jack