Q:Executing SQL within Textpad?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Kyle Monson

Q:Executing SQL within Textpad?

Post by Kyle Monson »

Is it possible to execute SQL statements within TextPad? I have a SQL Server and have been using query analyzer to write and test code, I much prefer using Textpad to edit the code so after I write it I cut and paste it into QA, I was wondering if there is a way to skip that step and bring the results backinto a new document window within textpad?


Thanks
Kyle
Erland Sommarskog

Re: Q:Executing SQL within Textpad?

Post by Erland Sommarskog »

Of course there is. You could set up a tool which invokes ISQL or OSQL to pass the file to SQL Server. There are a few things to watch out for though.

ISQL uses DB-Library, which means that all ANSI settings are off. This could be handled by setting them on the database or the configuration parameter useroptions. With OSQL all ANSI settings are on but QUOTED_IDENTIFIER. This may or may not be an issue. If you are using indexed views or indexed computed columns it certainly is. (Recall that when you save a stored procedure, the settings for QUOTED_IDENTIFIER and ANSI_NULLS are saved with the procedure.)

For both applies that you have to watch out for ANSI/OEM conversion if you are using non-ASCII characters. With ISQL you can turn this off in the Client Network Utility. With OSQL you can't turn it off.

To see some examples on how to set up the Textpad, you can check out http://www.abaris.se/abaperls/doc/textpad.html. This page shows how to set up Textpad for use with ABASQL, which is home-built thing with quite some bells and whistles that we use in our shop.
Post Reply