SQLServerCentral Logo SQLServerCentral Logo
  • Articles
  • Editorials
  • Stairways
  • Forums
    • Forums home
    • Active threads
    • Latest topics
    • Most popular
    • Leaderboard
  • Scripts
  • QotD
  • Books
  • Blogs
  • Register
  • Login
  • Write for us
  • Menu
  • Articles
  • Editorials
  • Stairways
  • Forums
    • Forums home
    • Active threads
    • Latest topics
    • Most popular
    • Leaderboard
  • Scripts
  • QotD
  • Books
  • Blogs
  • Write for us
  • Register
  • Login

sqlks

  • Profile
  • Topics Started
  • Replies Created
  • Leaderboards

sqlks

Account

  • Last login: May 2nd 2025
  • Login count: 391
  • Reputation: Old Hand
  • Points: 378

About

  • Description: using System;

    namespace Test1
    {
    class Program
    {
    static void Main(string[] args)
    {
    string word1 = "", word2 = "";

    foreach (var arg in args)
    {
    if (arg.StartsWith("word1="))
    word1 = arg.Substring("word1=".Length);
    else if (arg.StartsWith("word2="))
    word2 = arg.Substring("word2=".Length);
    }

    Console.WriteLine($"{word1} {word2}");
    }
    }
    }
    ------------------------
    using System;
    using System.IO;
    using Microsoft.SqlServer.Dts.Runtime;

    public class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    {
    public void Main()
    {
    string output = Dts.Variables["User::OutputVar"].Value.ToString();
    string path = @"D:\testpgmout\output.txt";

    File.WriteAllText(path, output);

    Dts.TaskResult = (int)ScriptResults.Success;
    }
    }
    ---------------------

Forum

  • Forum role: Participant
  • Forum topics: 2
  • Forum replies: 1
  • About SQLServerCentral
  • Contact Us
  • Terms of Use
  • Privacy Policy
  • Contribute
  • Contributors
  • Authors
  • Newsletters
Redgate logo