Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:21:48+00:00 2026-05-26T03:21:48+00:00

I discovered that I couldnt be granted BULKADMIN or SYSADMIN role on my hosted

  • 0

I discovered that I couldnt be granted BULKADMIN or SYSADMIN role on my hosted sql server db and trying to bypass the bulk insert operation by creating a .sql file containing insert statements. The insert statements are created using a xls macro, so theres some bit of manual bodyshopping work that I am doing now. So let me draw the problem here.

I have a text file with the following contents –

10/05/2011 01:21 PM 1-16332-1008261.psa 
10/05/2011 01:21 PM 1-16332-1011698.psa 
10/05/2011 01:21 PM 1-16332-1023151.psa 
10/05/2011 01:21 PM 1-16332-1035695.psa 
10/07/2011 03:36 PM 1-16332-1023193.psa 
10/07/2011 03:36 PM 1-16332-1035694.psa 
6 File(s) 8,933,754 
2 Dir(s) 1,675,268,096 free

What I want to achieve in my final output file is this –

insert into xyz.abcd values('10/05/2011', '1-16332-1008261.psa');
insert into xyz.abcd values('10/05/2011', '1-16332-1011698.psa');
insert into xyz.abcd values('10/05/2011', '1-16332-1023151.psa');
insert into xyz.abcd values('10/05/2011', '1-16332-1035695.psa');
insert into xyz.abcd values('10/07/2011', '1-16332-1023193.psa');
insert into xyz.abcd values('10/07/2011', '1-16332-1035694.psa');
go

Please take a note that the last two lines from my input text file are to be dinged in my final output sql file. Its kind of automating the xls macro I am manually doing now by dos scripting where the ‘insert into xyz.abcd values’ is considered to be a constant string which is written to each new line before the actual date and filename from the file been read.
I will name my final output file as a .sql and execute it remotely from my computer.
Can somebody please help me if this can be doable in DOS programming or not.

I have tried to present a similar problem in another post which I am trying to delete, but am unable to do so. Guess I didnt explain the other one properly.

I know I can redirect the string as a literal to a file by the echo command but the challenge is how do I read fraction of a line from one file and put them into a new file.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:21:48+00:00Added an answer on May 26, 2026 at 3:21 am

    please put following code to notepad and save it as CMD batch file (e.g. Convert2SQLfile.cmd). Then run it from command line with 3 parameters, while:

    • 1st parameter contains path to source file from which data will be read
    • 2nd parameter contains path to destination file to which data will be saved
    • 3rd parameter contains table name which should be stored in SQL command instead of “xyz.abcd” you have in your request

    Hope this helps.

    Regards,
    Standa

        @echo off
        SetLocal
    
        SET App.SourceFile=%1
        SET App.DestinationFile=%2
        SET App.Table=%3
    
    
        FOR /f "usebackq tokens=1,4" %%i IN (`type %%App.SourceFile%%`) DO (
            IF #%%j# NEQ ## (
                IF #%%j# NEQ #free# (
                    ECHO insert into %App.Table% values ^('%%i', '%%j'^); >> %App.DestinationFile%
                )
            )
        )
    
        ECHO go >> %App.DestinationFile%
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I discovered that my fresh installation of Apache HTTP Server is able to
Trying to create a virtual machine using VMPlayer, I discovered that as the Chrome
I discovered that one of the tables of a legacy db I'm working on
I discovered that it is possible to extract the hard-coded strings from a binary.
We recently discovered that the Google Maps API does not play nicely with SSL.
I've discovered that any time I do the following: echo '<a href=http:// title=bla>huzzah</a>'; I
I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as
I've discovered that cElementTree is about 30 times faster than xml.dom.minidom and I'm rewriting
I've just discovered that Oracle lets you do the following: SELECT foo.a, (SELECT c
UPDATE : I discovered that I was calling the permalink from another table, with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.