How to use SQLite db file location in select?How to list the tables in a SQLite database file that was opened with ATTACH?SQLite - UPSERT *not* INSERT or REPLACESqlite primary key on multiple columnsHow do I check in SQLite whether a table exists?Improve INSERT-per-second performance of SQLite?What are the best practices for SQLite on Android?Is there an SQLite equivalent to MySQL's DESCRIBE [table]?Select first row in each GROUP BY group?How to delete or add column in SQLITE?How to tell SQLITE to ignore STDIN?

How invisible hand adjusts stock prices if company is listed on multiple exchanges, under multiple currencies, and one of the currencies plunges?

What is the difference between a translation and a Galilean transformation?

Friend is very nitpicky about side comments I don't intend to be taken too seriously

Why is the the worst case for this function O(n*n)

Distinguishing between octahedral and tetrahedral holes

Capacitors with same voltage, same capacitance, same temp, different diameter?

Why does low tire pressure decrease fuel economy?

How to set any file manager in Linux to show the duration like the Length feature in Windows Explorer?

How do Scrum teams manage their dependencies on other teams?

Are programming languages necessary/useful for operations research practitioner?

Distance faces never sharp/clear. Too picky?

How can Schrödinger's cat be both dead and alive?

Text is continuing wider than the width of the page and not passing to new line

I multiply the source, you (probably) multiply the output!

How there are 3 possible tautomers of 2,2,4-trimethylheptane-3,5-dione?

When calculating averages, why can we treat exploding die as if they're independent?

Remove outer padding in tikzcd

Do you need to burn fuel between gravity assists?

I need to know information from an old German birth certificate

Why would an AC motor heavily shake when driven with certain frequencies?

Is a MySQL database a viable alternative to LDAP?

Can you mark a new target with the Hunter's Mark spell if the original target shifts to a different plane?

Why can linguists decide which use of language is correct and which is not?

How can I finish my PhD?



How to use SQLite db file location in select?


How to list the tables in a SQLite database file that was opened with ATTACH?SQLite - UPSERT *not* INSERT or REPLACESqlite primary key on multiple columnsHow do I check in SQLite whether a table exists?Improve INSERT-per-second performance of SQLite?What are the best practices for SQLite on Android?Is there an SQLite equivalent to MySQL's DESCRIBE [table]?Select first row in each GROUP BY group?How to delete or add column in SQLITE?How to tell SQLITE to ignore STDIN?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I would like to use the main database file location in function (replace or other) as input data. How can i get it?




for example: replace('c:tempmain.db','main.db','')




I'm creating a database script for command line use under win10.



.database command result seems to be fine, but how to use in replace input?



EDIT: I have to use the location as variable, because i run the script from command line, recursively in a lot of directories with a lot of small databases, so i can't use constant value in replace.



The cmd line command:




forfiles /p c:temp /m files.db /s /c "cmd /c c:sqlite3.exe @path < c:BookDbDataCopy.txt"




I want to use the path in the select as variable.










share|improve this question





















  • 1





    Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

    – Schwern
    Mar 28 at 7:40












  • Sorry, my question was inaccurate, i updated that.

    – AndrasK
    Mar 28 at 8:58

















0















I would like to use the main database file location in function (replace or other) as input data. How can i get it?




for example: replace('c:tempmain.db','main.db','')




I'm creating a database script for command line use under win10.



.database command result seems to be fine, but how to use in replace input?



EDIT: I have to use the location as variable, because i run the script from command line, recursively in a lot of directories with a lot of small databases, so i can't use constant value in replace.



The cmd line command:




forfiles /p c:temp /m files.db /s /c "cmd /c c:sqlite3.exe @path < c:BookDbDataCopy.txt"




I want to use the path in the select as variable.










share|improve this question





















  • 1





    Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

    – Schwern
    Mar 28 at 7:40












  • Sorry, my question was inaccurate, i updated that.

    – AndrasK
    Mar 28 at 8:58













0












0








0








I would like to use the main database file location in function (replace or other) as input data. How can i get it?




for example: replace('c:tempmain.db','main.db','')




I'm creating a database script for command line use under win10.



.database command result seems to be fine, but how to use in replace input?



EDIT: I have to use the location as variable, because i run the script from command line, recursively in a lot of directories with a lot of small databases, so i can't use constant value in replace.



The cmd line command:




forfiles /p c:temp /m files.db /s /c "cmd /c c:sqlite3.exe @path < c:BookDbDataCopy.txt"




I want to use the path in the select as variable.










share|improve this question
















I would like to use the main database file location in function (replace or other) as input data. How can i get it?




for example: replace('c:tempmain.db','main.db','')




I'm creating a database script for command line use under win10.



.database command result seems to be fine, but how to use in replace input?



EDIT: I have to use the location as variable, because i run the script from command line, recursively in a lot of directories with a lot of small databases, so i can't use constant value in replace.



The cmd line command:




forfiles /p c:temp /m files.db /s /c "cmd /c c:sqlite3.exe @path < c:BookDbDataCopy.txt"




I want to use the path in the select as variable.







sqlite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 8:57







AndrasK

















asked Mar 28 at 7:19









AndrasKAndrasK

12 bronze badges




12 bronze badges










  • 1





    Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

    – Schwern
    Mar 28 at 7:40












  • Sorry, my question was inaccurate, i updated that.

    – AndrasK
    Mar 28 at 8:58












  • 1





    Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

    – Schwern
    Mar 28 at 7:40












  • Sorry, my question was inaccurate, i updated that.

    – AndrasK
    Mar 28 at 8:58







1




1





Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

– Schwern
Mar 28 at 7:40






Since your script will have opened the SQLite database, it already knows where it is located. It doesn't have to ask the database.

– Schwern
Mar 28 at 7:40














Sorry, my question was inaccurate, i updated that.

– AndrasK
Mar 28 at 8:58





Sorry, my question was inaccurate, i updated that.

– AndrasK
Mar 28 at 8:58












1 Answer
1






active

oldest

votes


















0
















I got it :)



create table path (a text);
.mode csv
.output 'c:data.csv'
.databases
.import 'c:data.csv' path



The solution:
- create a table for the path
- write the command output in file
- import the file in table
- select the table in replace variable :)



select replace((select a from path where a like 'main%'),'main: c:',''), t.* from path;






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392073%2fhow-to-use-sqlite-db-file-location-in-select%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    I got it :)



    create table path (a text);
    .mode csv
    .output 'c:data.csv'
    .databases
    .import 'c:data.csv' path



    The solution:
    - create a table for the path
    - write the command output in file
    - import the file in table
    - select the table in replace variable :)



    select replace((select a from path where a like 'main%'),'main: c:',''), t.* from path;






    share|improve this answer





























      0
















      I got it :)



      create table path (a text);
      .mode csv
      .output 'c:data.csv'
      .databases
      .import 'c:data.csv' path



      The solution:
      - create a table for the path
      - write the command output in file
      - import the file in table
      - select the table in replace variable :)



      select replace((select a from path where a like 'main%'),'main: c:',''), t.* from path;






      share|improve this answer



























        0














        0










        0









        I got it :)



        create table path (a text);
        .mode csv
        .output 'c:data.csv'
        .databases
        .import 'c:data.csv' path



        The solution:
        - create a table for the path
        - write the command output in file
        - import the file in table
        - select the table in replace variable :)



        select replace((select a from path where a like 'main%'),'main: c:',''), t.* from path;






        share|improve this answer













        I got it :)



        create table path (a text);
        .mode csv
        .output 'c:data.csv'
        .databases
        .import 'c:data.csv' path



        The solution:
        - create a table for the path
        - write the command output in file
        - import the file in table
        - select the table in replace variable :)



        select replace((select a from path where a like 'main%'),'main: c:',''), t.* from path;







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 11:22









        AndrasKAndrasK

        12 bronze badges




        12 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392073%2fhow-to-use-sqlite-db-file-location-in-select%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript