How to insert the file name to the start and the end of a SQL file by a powershell script

I just began to learn powershell script and I have a problem that I cannot figure out. I have a lot of .sql files. I need to insert its file name to the beginning of the file (After USE statement) and the end of the file (before the last END statement). Is
there anybody knowing how to do this?
Thanks so much
Regards

Actually, I want to add a insert SQL statement to the beginning of the file and the end of the file. Only the file name is a variable and different among
different files. All the other sql statements are the same and can be hard coded. Hopefully it helps –
The problem I think is that I want to add the same thing (except the file name) to hundreds of sql files and only the file name is different. I do not want
to add it manually and want to use a script to add it – 

Similar Messages

  • HT5132 The pop up appears when I open aperture, I do not have a mobil me account with photos and the sync never seems to start and the dialogue box will not go away. How do I get rid of it?

    When I open aperture a pop up appears that tells me that my mobil me photos will be moved. When I click OK, nothing happens and I have left it for hours. I can not get rid of the pop up and I can not get out of aperture. I have to force the computer to shut down. Any thoughts?

    Quit Aperture - force quit if necessary (or try this:
    If Aperture is unresponsive, how to avoid force quitting?
    Launch Aperture again. When the panel appears, press the "Learn more" button, not o.k.
    Then use the "File > Web Accounts > Manage Web Accounts" menu entry from Aperture's main menu bar and remove "MobileMe" from the list of accounts in the accounts pane by pressing "-".
    If the above does not work, disconnect the internet (Wi-fi, Ethernet, whatever you have), before you launch Aperture again. Now the panel should no longer appear.
    Also sign out of MobileMe in the System Preferences Mobile Me tab, to stop the panel to appear again.
    Good luck
    Léonie

  • Changing the technical names of an ODS and queries

    Can I change the technical name of an ODS and the queries that are built on it? If so how? Thanks

    Hi Niten,
    As said by others it is not possible to change the technical name of any BW Object as there are too many complexities involved. However a possible option is create another ODS/cube and queries as the copy of the existing one and then transfer all the data.
    Refer this post:
    Re: Change infocube name
    Bye
    Dinesh

  • How do I get my photos to sort by file name when sync'd to the iPad?

    How do I get my photos to sort by file name when sync'd to the iPad?  The default sorting method changes the order of pictures when sync'd from my pc.

    http://support.apple.com/kb/HT4221

  • How to copy the photo with file name at window 7 and search specific one in iphone 4s?

    How to copy the photo with file name at window 7 and search specific one in iphone 4s?

    Clendenen02 wrote:
    2) It would be equally helpful if there was something that would take the name of the picture file and spotlight comment, copy and paste it to a movie file's comments with the same name but obviously has different extention. For an example
    In a Pictures folder
    Name: Dark Knight, The.jpeg       Comment: (2008) Genre: Action...             <- copy comment
    In a Movie Folder
    Name: Dark Knight, The.m4v       Comment:                                               <- paste 
    and do this for all 700 files
    This Bash script will do it.
    Edit "PicDir" and "MovDir" to the location of your Folders
    (Note: The comment is written to the m4v file using xattr, so the Spotlight comment field appears blank in Finder, but the comment metadata is still indexed by Spotlight (If you add a Spotlight comment from Finder, it is stored both as an extended attribute and in a .DS_Store file)
    #!/bin/bash
    PicDir=$HOME/Desktop/Pictures
    MovDir=$HOME/Desktop/Movies
    for f in $PicDir/*
    do
         if [ ! -d "$f" -a "${f##*.}" == "jpeg" ]; then
              comment=$(mdls -raw -name kMDItemFinderComment "$f")
              if [[ $comment != "(null)" ]]; then
                   picname=${f##*/}
                   movname=${picname%.*}.m4v
                   if [ -e "$MovDir"/$movname ]; then
                         xattr -w com.apple.metadata:kMDItemFinderComment "\"$comment\"" "$MovDir"/$movname
                   fi
              fi
         fi
    done

  • Can I append the file name from a Foreach Loop Container Enumerator into a SQL Server Statement?

    I would like to pass back via an Email the name of the file that was successfully FTP'ed to a remote server. And I was hoping to do this via an Execute SQL Task with the following SQL Statement...but I just don't know if it will append the Foreach Loop Container
    variable enumerator to the appended Email message that I am building in SQL Server or if I can and how I can...
    I sort of get the feeling that I can try and do this via Dynamic SQL...I just don't know if by building dynamic SQL if my Foreach Loop Container enumerator variable will be appended to my Email Message via the SQL Server UPDATE 
    @[User::FTPFHFileName]
    Or do I add a Data Flow Task and an OLE DB Command and pass the Foreach Loop Container enumerator variable to a Stored Procedure referenced in the OLE DB Command via a "?"
    Thanks for your review and am hopeful for a reply.

    Hello,
    It seems that the issue had been solved and thanks for your sharing. It will be very beneficial for other community members who have similar questions.
    I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings or concerns you may have.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • File name should change by selecting the radio buttons

    Hi all,
    PARAMETERs: p_file LIKE rlgrap-filename.
    PARAMETERS: p_app RADIOBUTTON GROUP rg DEFAULT 'X',
                             p_pre RADIOBUTTON GROUP rg.
    this is to download the ITAB data to presentation and application servers depending upon the radio button selected.
    if i select p_pre , then default download path is : 'C:/ download.txt'.
    if i select P_app , default download path is : '\usr\sap\EBG\SYS\profile\DOWN.TXT'.
    how the file name should change by selecting the radio buttons ?
    Thanks
    KR

    Hi,
    DATA: c_x VALUE 'X'.
    selection-screen begin of block input with frame title text-000.
    parameters :desktop     radiobutton group rg_f user-command rg_f,
                       in_file type ibipparms-path modif id ps DEFAULT 'C:/ download.txt',
                menu     radiobutton group rg_f ,
                       sys_file type ibipparms-path modif id as default  '\usr\sap\EBG\SYS\profile\DOWN.TXT' .
    selection-screen end of block input.
    at selection-screen output.
      if desktop is initial and menu is initial.
        desktop = c_x.
      endif.
      perform f_toggle_finputs.
    form f_toggle_finputs.
    loop at screen.
        if screen-group1 = 'PS'.
          if desktop = c_x.
            screen-input    = 1.
    *         sys_file = c_server_path.
          else.
            screen-input    = 0.
          endif.
        endif.
        if screen-group1 = 'AS'.
          if menu = c_x.
            screen-input    = 1.
    *        clear: in_file.
          else.
            screen-input    = 0.
          endif.
        endif.
        modify screen.
      endloop.
    endform. "f_toggle_finputs
    Hope this helps u.
    Thanks.

  • Include Flat file name as a field in the PSA / DSO.

    Hi,
    I have a requirement to include the Flat file name also in the DSO which is used for loading the data from a flat file source. I have created a new infoobject for File Name in the DSO. Can you guide me from which table I can get this information.
    I was thinking of reading this information from the table which stores the file name in a routine in the transformation to the DSO.
    I came across the table RSLDPSEL, it stores the Infopackage name and file name. But this does not work when I am using the same infopackage to load multiple files. Thanks in advance.
    Regards,
    Hari.

    Hi,
    The main challenge is to get the Technical name of the infopackage in the transformation ( field routine) from PSA (Datasource Source) to DSO for the Filename info object.
    Is there any table which stores the Infopackage and the corresponding data target information in BI 7.0 sothat I could use the field routine in transformation to get the Infopackage ID based on the data target (DSO) ?
    Once I have the technical name of the Infopackage, my logic is to query the RSLDPSEL table and find the file name based on Infopackage ID.
    Please share your thoughts on how this scenario could be realised.
    Thanks,
    Regards,
    Hari

  • How do i fix my wifi if it connects and the bars are blue but no check sign appears next to the wifi name and does not connect to the internet???

    How do i fix my wifi if it connects and the bars are blue but no check sign appears next to the wifi name and does not connect to the internet???

    Did you already try to reset the iPod by holding the sleep and home button for about 10sec, until the Apple logo comes back again? You will not lose data.
    If this does not work, try to reset the network settings in Settings/General/Reset. After that you'll have to put in the passwords for all known networks again.
    More troubleshooting can be found here:
    iOS: Troubleshooting Wi-Fi networks and connections

  • I set up my new computer using the apple ID i always use, and then later migrated all my files from my old mac book to the same new one, but under a different user (same ID). how do i consolidate the two users on my new mac book?

    i set up my new computer using the apple ID i always use, and then later migrated all my files from my old mac book to the same new one, but under a different user (same apple ID). how do i consolidate the two users on my new mac book?

    Well if you use the Finder Go menu to Computer, a window opens up double click on your boot drive and then on Users folder, open the other user folder and open Public and drop your files into DropBox
    When you do this it will copy them and change the permissions and user assigned to it, so log into the other user and place them into your respective normal folders.
    Once you have all your files over and don't need the old user, use System Preferences > Accounts to delete it if you wish, however it's good two Admin accounts on the machine in case something bad happens in the other. Some people for security reasons on use a Standard account for most uses and a emergency Admin account.
    One can still do most Admin things in Standard user.

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

  • I have copied over my music file to a new computer and the music shows on itunes but wont play. When I track where the song is located it is reading the wrong information. How do I change this as Edit Preferences has the right location

    I have copied over my music files to a new computer and the music shows on itunes but wont play. When I track where the song is located it is reading the wrong information. How do I change this as Edit>Preferences has the right location?

    Select one of the tracks with a broken link, press ctrl-i to Get Info. Say No when iTunes asks if you would like to locate the track, then look at the Summary tab for the location expects to find the file in.
    Now try to locate the file in question. The two locations should give a clue as to what to do next.
    Here is an example with a file I've deliberately moved from the new layout to the old pre-iTunes 9 layout.
    This means iTunes is expecting to find the file at:
    D:\iTunes\iTunes Media\Music\a-ha\Take On Me\01 Take On Me.mp3
    but it isn't there because I've moved it to:
    D:\iTunes\iTunes Media\a-ha\Take On Me\01 Take On Me.mp3
    which is where it would have lived back in iTunes 8 (though the media folder would have been called iTunes Music back then as well).
    If you can provide the expected and actual locations of a broken track I should be able to suggest the easiest way to resolve things.
    tt2

  • Am new at pages and cannot figure out how to insert a bullet where I want it in the text, not at the beginning of the paragraph.  Word was much easier for me

    Am new at this forum and also at pages and can't figure out how to insert a bullet where I want it in the text, not at the beginning of the paragraph.  I found word much easier to use.  Please help. Trying to do a resume.

    On a US keyboard it is Option + 8 (above the letters). •

  • I have a question about extracting pages.  When I do the function, adobe saves the individual files as " file name space page number ", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I a

    I have a question about extracting pages.  When I do the function, adobe saves the individual files as "<file name><space><page number>", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I am using excel to concatenate some data to dynamically build a hyperlink to these extraced files.  It casues me problems, however, for the space to be the the file name.  Is there any way to change the default behavoir of this function to perhaps use a dash or underscore instead of a space?

    No, you can't change the default naming scheme. You can do it yourself if you extract the pages using a script instead of using the built-in command.

  • The file name is not valid. The file name is a device or contains invalid characters.

    Hi ,
    I am getting below error in SSIS 2008 package when it is run through control-m
    The file name is not valid. The file name is a device or contains invalid characters.
    component "FF_SRC_InboundFidelityInputFile" (1) failed the pre-execute phase and returned error code 0xC020207E.
    although this package is working fine in dev environment from visual studio.
    control-m agent has proper permissions to the folder still it is failing. Please if anyone knows solution for this issue. I am working on this issue since more than a week but reached nowhere. Please help.
    Thanks 
    Paras Gupta

    Hi Paras,
    Based on your description, it is not the VS IDE issue, if it is related to the SSIS, I suggest you post the issue in this forum here:http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlintegrationservices
    , and there you would get better response.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Sharing documents in iCloud

    I have a business iCloud account so that I can work on documents at home. My boss has the documents in iBooks but when I go to my ibooks they are not there.  We both have our documents and data turned on.  Any input would be great.

  • EXPORTING IN MPEG-2

    Why iMovie HD 6 can't export in MPEG-2 ? In older version, it could be possible to export in that format. Now, there is only the MPEG-4 format. I want to export in MPEG-2 and use the movie in DVD Studio Pro. MPEG-4 do the same job ?

  • 1st Meet-the-expert session is now open for registration

    Hello, SAP's CAF PM team will start a session series (so called 'Meet-the-expert' sessions) to bring closer the CAF topic to the SDN community. The first session is now arranged and open for registration (<a href="https://sap.webex.com/sap/j.php?ED=8

  • Report addition via PFCG - erraneous

    Hi All, I have a issue.The reports added to a role thr PFCG is not visible when the role is opened in Bex. The table AGR_HIER is not updating the unique ID of the query when added via PFCG and hence this issue. Is there some settings that we need to

  • Adding query to Portal

    Hi, i'm trying to publish a Query on Portal. Once on the Content Administration i see some folders and roles, if I right click on a folder i can successfully create an iView with the query on it but i still can't see it on the Portal (there's already