You want someones password? Really? Their sql or windows password? Nope. If it was that easy, then all forms of security would be tossed out the window (windows would be tossed out too). There are hacks around for assorted things, but not the password.
oooohhhh. Yes, but I only know one way - there may be others, even better ones and it gets more than that xp_cmdshell 'dir *.*' I'm not a dos person (I went directly from mainframe to client/server) so I dont know how to find the current directory only from dos, but I'm sure its available and anything you do that way, you can do with xp_cmdshell Chris
Use XP_CMDSHELL "CD" which will return the current directory _________ Satya SKJ Moderator SQL-Server-Performance.Com
Satya, wouldn't the output always be something like 'C:winntsystem32' ??? I'm not sure what is meant by working directory. There are some paths stored in the registry like SQLDataRoot and SQLPath. Frank http://www.insidesql.de http://www.familienzirkus.de
Frank I think it will return the default path from SQL as MSSQLBINN directory and not the windows default directory. I'm aware of those registry keys but as a percautionary measure didn't mentioned them. TA _________ Satya SKJ Moderator SQL-Server-Performance.Com
Actually I was asking because in all three cases (local, production and test server) it did return that 'c:winntsystem32' Frank http://www.insidesql.de http://www.familienzirkus.de
That's right. Using cmdshell will take you to the system folder, no memory of your current working directory. So our conclusion is, there is no way? quote:Originally posted by FrankKalis Actually I was asking because in all three cases (local, production and test server) it did return that 'c:winntsystem32' Frank http://www.insidesql.de http://www.familienzirkus.de
The working directory on the workstation? Sorry, little bit confused. Frank http://www.insidesql.de http://www.familienzirkus.de
I guess Current Working Directory is an irrelavent issue to SQL Server, that is why they don't support this idea, or, all queries are run from the system folder afterall. What I meant is, if I build my db in a particular folder, say, d:mydb, all my scripts are stored in d:mydbin, if I run one script, I like to know its absolute path such as d:mydbin his_script.sql
Well, now I got it! One solution could be to open Query Analyzer -> Extras -> Options -> General and set the first value to whatever directory you like -> Save and exit. Then open Windows registry, search for Query Analyzer. In my case I found HKEY_USERS......SoftwareMicrosoftMicrosoft SQl Server80ToolsSQL Query AnalyzerOptionsGeneralTabScriptsPath the path I specified in QA. You can query this with the undocumented xp xp_regread. HTH Frank http://www.insidesql.de http://www.familienzirkus.de
Oops, hit the button too early. Syntax for xp_regread is EXEC master.dbo.xp_regread hive, key, value [, result OUTPUT] where hive could be 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT'.... Note this xp is not documented and M$ reserves the right to change it at service pack level Frank http://www.insidesql.de http://www.familienzirkus.de
Thanks Frank. Your answer spin off a new topic: using xp_regread can retreive the value of a reg key if you know the exact name of the key. What if I want to retrieve all name value pairs under one certain key, just like select * from <table>? Here I don't know the name of any sub-key, and possibly don't even know if there is any sub-key. quote:Originally posted by FrankKalis Oops, hit the button too early. Syntax for xp_regread is EXEC master.dbo.xp_regread hive, key, value [, result OUTPUT] where hive could be 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT'.... Note this xp is not documented and M$ reserves the right to change it at service pack level Frank http://www.insidesql.de http://www.familienzirkus.de
If I undertand what you need use something like: xp_cmdshell 'dir *.exe /s' this give you all exe from current directory to any subdirectory under current. In your case: xp_cmdshell 'dir d:mydb *.exe /s' Hope help. Luis Martin ...Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true. Bertrand Russell
Thanks. quote:Originally posted by LuisMartin If I undertand what you need use something like: xp_cmdshell 'dir *.exe /s' this give you all exe from current directory to any subdirectory under current. In your case: xp_cmdshell 'dir d:mydb *.exe /s' Hope help. Luis Martin ...Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true. Bertrand Russell
It is possible, and also undocumented EXECUTE master.dbo.xp_regenumkeys 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftMicrosoft SQL Server' EXECUTE master.dbo.xp_regenumvalues 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftMicrosoft SQL Server' Frank http://www.insidesql.de http://www.familienzirkus.de
Thanks a lot, Frank! quote:Originally posted by FrankKalis It is possible, and also undocumented EXECUTE master.dbo.xp_regenumkeys 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftMicrosoft SQL Server' EXECUTE master.dbo.xp_regenumvalues 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftMicrosoft SQL Server' Frank http://www.insidesql.de http://www.familienzirkus.de