New script .... from script

clem0338
edited April 28 in General

Hi,

is there a way to create/add a script with a predefined type and content

Type SQL in my case with any SQL content based on a root C# script

USE [dbname]
SELECT [column names]
FROM [tablename]

and open it in LINQPad without to save the file beforehand ?

I'm using LP to optimize hundreds of queries and having this functionality would make my day way easier

Thanks a lot
Regards

Comments

  • One option to consider, you could create a script that would generate the files with the desired content. The format is fairly straightforward, starts with XML content for the metadata, followed by the actual script content. You could then have linqpad either open or run the generated script afterwards. Util.OpenScript() or Util.Run() respectively.

    If you're going to be generating a lot of these scripts, this may be the easiest way to go.

  • @JeffMercado thanks for your feedback, this is exactly what I am doing now. I was just dreaming about a method like Util.Run that could add a new tab and possibly execute that script directly without having to save any file. Thanks