Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQlite script

string script = File.ReadAllText(@"E:someSqlScript.sql");

// split script on GO command
IEnumerable<string> commandStrings = Regex.Split(script, @"^s*GOs*$", RegexOptions.Multiline | RegexOptions.IgnoreCase);

Connection.Open();
foreach (string commandString in commandStrings)
{
    if (!string.IsNullOrWhiteSpace(commandString.Trim()))
    {
        using(var command = new SqlCommand(commandString, Connection))
        {
            command.ExecuteNonQuery();
        }
    }
}     
Connection.Close();
Comment

PREVIOUS NEXT
Code Example
Sql :: select * from mysql.proc 
Sql :: sql declare variable single line 
Sql :: db2 foreign keys 
Sql :: how to make trigger in phpmyadmin 
Sql :: value of sold product using having and group by in sql 
Sql :: prestashop alter table if not exists 
Sql :: copy data from cell to cell mysql 
Sql :: convert sql to linq online converter 
Sql :: error-expression-select-list-not-group-by-nonaggregated-column/ 
Sql :: MYSQL create new query tab 
Sql :: mysql order specific records at the top 
Sql :: update top 100 order by sql server 
Sql :: SQL IN Operator With Duplicate Values 
Sql :: show tables in oracle 
Sql :: phpmyadmin tabellentyp ändern 
Sql :: PL SQL Adding elements to VARRAY from a cursor 
Sql :: sql developer export connections 
Sql :: Uncomment listen_address=localhost 
Sql :: sub blocks in sql 
Sql :: Join base on multiple or conditions 
Sql :: proc sql not in working 
Sql :: row_number equivalent MS Access for sequential id By Group (3) 
Sql :: Sql select by content lenght 
Sql :: kill slow queries mysql 
Sql :: mysql load data infile default file location 
Sql :: how to read the potentail error messages in ssis package 
Sql :: mysql table information 
Sql :: how to take recent row without limit in mysql 
Sql :: sparql year function 
Sql :: how to import datadd in sql 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =