January 24, 2005 at 2:49 pm
Hi Developers or DBA's,
A developer wrote a .exe app that reverses data captured (i.e. ABCD will return DCBA) using a .exe app written in .NET. He wants me to capture the output data that was reversed to a nvarchar string. Does anyone know how to do this? Is it possible to use 'xp_cmdshell'?
Any ideas or points would be GREATLY appreciated!
Thanks,
Dave
January 24, 2005 at 3:05 pm
Seems over-complicated.
Why not take the raw captured data and use the built-in Sql Server REVERSE() string function instead of an external EXE ?
[Edit] If your design locks you into using the .Net exe, try this:
CREATE TABLE #CmdOutput (
OutputRow nvarchar(255) NULL
)
INSERT INTO #CmdOutput
EXEC master.dbo.xp_cmdshell 'YourProg.exe'
January 24, 2005 at 3:15 pm
Good point! But it is a little more complicated than that actually. The developers built an app that takes encryped credit card data and decrypts them. They run this app in a cmd window and they want me to somehow capture that decrypted data and save it to some type of a nvarchar string format. I'm not sure why, but thats what they're requesting.
January 24, 2005 at 6:19 pm
Why do you think they want to decrypt someone else's credit card number? They want to go shopping!
January 25, 2005 at 5:31 am
Would there be some way to put a COM wrapper around the assembly and use com in your stored procedure?
Russ
Russel Loski, MCSE Business Intelligence, Data Platform
January 25, 2005 at 7:20 am
Ask the developer to look up "ADO.NET" on MSDN.
Normally, when a solution involves xp_cmdshell, it's time to look at the solution. There's often a cleaner way to do it, without enabling application use of xp_cmdshell.
The business logic layer should handle database inserts, not the data layer.
Either the command-line app could insert the data itself, or another app could get the results from the command-line app (ideally through a different means then scraping shell output) and insert the data.
-Eddie
Eddie Wuerch
MCM: SQL
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply