Is there a way to find out programmatically using T-SQL where the current log folder is located for a SQL insatance? if for example the log folder is located under the C: as
I dont alot about sql server 2005(Express edition). For debugging purposes i want to copy the whole app_data folder(.mdf & .log files) on the production server to another folder on the same machine(or sometimes to a network folder). So when i copy and try to paste this App_data folder to a new location, i get this error message "cannot copy ASPNETDB: it is being used by another person or program. close any programs that might be using the file and try again." After reading the above message, i close visual web developer, stop the website in IIS and stop the SQLExpress service on the server and try again but still get the same message. So how can i make sure that all the programs accessing these database files are closed such that i'm able able to copy them to a different location.
I know a WMI event watcher can be used to watch forĀ a new file being added to a folder. However, I need to check for new folders being added to an existing folder. I haven't been able to find a post on doing this. Is there a way in WQL to check for a new folder being added instead of a new file? I've used SQL for years, but am new to SSIS.
I have a SharePoint (2007) Document Library site called B. Web Client is enabled on the server and B is mapped as a Drive (let's call it Y for this discussion)
I want to move documents in A to B. Easy enough, right? Not so....
I first started by creating a batch file that issues a COPY \A \Y /Y at the command prompt. Viola! Worked Great!
I then moved that command to a SQL Agent job as a CMDExec statement (exact same statement) and attempted to run it.....CRASH! It found the files in A but then said "The system cannot find the path specified"
Ok, so I tried it in SSIS. CRASH! Checked the error log. Same thing...
So I then checked the account under which the SQl Agent was running (special domain account for all our SQL Servers). Thinking it might mater I changed it to run under my name (I'm in Domain admin). I also ensured I had permissions to the SPS 2007 library as well. (I did).
Ran again! CRASH! Same error....
So, I created a batch file , placed thec ommand in the batch file and ran that from the command prompt! Viola! Worked Great.
So, I was thinking of how ingenious I was as I pasted my C:RootCopy.bat into my SQL Agent job. With a big grin on my face I right clicked and picked "Start Job at step".......CRASH! Same error.
Does anyone have any ideas on this ???????????????
I am trying to run a UNION ALL query in SQL SERVER 2014 on multiple large CSV files - the result of which i want to get into a table in SQL Server. below is the query which works in MSAccess but not on SQL Server 2014:
SELECT * INTO tbl_ALLCOMBINED FROM OPENROWSET ( 'Microsoft.JET.OLEDB.4.0' , 'Text;Database=D:DownloadsCSV;HDR=YES', 'SELECT t.*, (substring(t.[week],3,4))*1 as iYEAR, ''SPAIN'' as [sCOUNTRY], ''EURO'' as [sCHAR],
[Code] ....
What i need is:
1] to create the resultant tbl_ALLCOMBINED table
2] transform this table using PIVOT command with following transformation as shown below:
PAGEFIELD: set on Level = 'Item' COLUMNFIELD: Sale_Week (showing 1 to 52 numbers for columns) ROWFIELD: sCOUNTRY, sCHAR, CATEGORY, MANUFACTURER, BRAND, DESCRIPTION, EAN (in this order) DATAFIELD: 'Sale Value with Innovation'
3] Can the transformed form show columnfields >255 columns i.e. if i want to show all KPI values in datafield?
P.S: the CSV's contain the same number of columns and datatype but the columns are >100, so i dont think it will be feasible to use a stored proc to create a table specifying that number of columns.
I have a set of folders with the following structure:
MainFolder
1999
SpreadsheetA.xls
SpreadsheetB.xls
SpreadsheetC.xls
2000
SpreadsheetA.xls
SpreadsheetB.xls
SpreadsheetC.xls
etc.
Is there a way that I can use the foreach loop container to loop the sub folders? My plan was to get the folder name and path into a variable, use this to build the connection string for each file in this folder, carry out the upload for that folder, then move onto the next folder and do the same thing, but I cannot see a way to do this.
Hi,Can anyone tell me how to select the "most recent" date values from agrouped query? Consider the following:CREATE TABLE [dbo].[TestQuery] ( [ID] [int] NOT NULL , [ID_Parent] [int] NOTNULL , [Date] [datetime] NOT NULL ) ON [PRIMARY]This is a simplified adjacency list. What I want to do is find the highestvalued item by date for each sub-tree. In other words, the single highestdate item when This.ID_Parent = That.ID_Parent. I think I first need togroup by ID_Parent, then select the TOP 1 from this query, but how toaggregate them so I get the TOP 1 for each ID_Parent?Thanks for any help you can give me,Robin
As SQL Server 2016 category is not created so I am posting this query in SQL Server 2014 window.
I have enabled Query Store in SQL Server 2016 using ALTER DATABASE and later tried with Properties of Database too. But I am not able to see the Query Store subfolder under database.
I am having problem with moving a file from one folder to another folder. Here is the detailed scenario:
I want to move a input.csv file from shared input folder to shared archive folder. i am using the below code to do this. declare @inpath varchar(100) SET @inpath = 'move "\abcdefINPUTinput*.csv" "\abcdefARCHIVEarchive.csv"' EXEC @filestatus = master..xp_cmdshell @inpath but the problem was it was cutting the input.csv file from INPUT folder but not pasting it in the ARCHIVE folder. I really appreciate if anyone can help me to solve this or anyone can tell some workarounds.
hi, I am curious to know if I can do the following from within a store procedure.
If I have a folder under c drive c:clientand would like to check if there is any files inside the client folder, how can I write such code in sql into a store procedure. I want to do some actions like expoft table data (bcp) into the client folder if there is no text files..... I do appreciate your help
What would be the impact of replacing the SQL 2005 90 ToolsBinn folder with the SQL 2000 80 toolsinn folder? A colleague of mine did this in a SQL 2005 production environment so that he could still use isql.exe. Unfortunately, users are getting kicked out of the database and I'm thinking the binn folder may be a factor. Thoughts?
Hi All,I have a multiple files, but they are store in different directory onthe server. I want open those files and insert it into the databaseusing bcp.Example files structure dir:\xyz123abc ext1.txt\xyz123abc ext2.txt\zyz123999 ext2.txtbcp "dabase" in \xyz123abc ext1.txt -c -S"servername' -Usa-Ppassword -T".is there away to loop througth each dir, get the files, excecute thebcp, then go to next folder.Please help. Thanks in advance.Ted Lee
My Log file connection is set to "Create Folder". According to BOL, this seems to indicate that the folder(s) that the log file will reside in will be created if they do not already exist. Yet I am receiving a package validation error when I execute the package. The full error is:
The SSIS logging provider has failed to open the log. Error code: 0x80070003 The system cannot find the path specified.
As a side note, I thought that setting the connection to "Create File" would recreate the log file each time it ran but that does not seem be the case. Instead, the file gets appended.
Greetings, Salutations, and Howdy I'm using VWD on the local box and WS 2003/SQL Express on the remote box. The first time I upload the site, the upload works great. Later after uploading updates, new pages, etc. the upload still works great. BUT.....when I try to upload anything in the App_Data folder, I get a copy error, access denied. On a pre-existing site with App_Data ....How do you upload the App_Data folder or it's contents to the remote server? Thanks^2
Anyone knows , get a SQL Backup Folder Path in asp.net.Some Systems it displayed like D:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackup and some Systems like E:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackup and etc. i need to get a path for backup programmatically.Please help me.
HI, I found that we can keep .mdf file in App_Data folder and use the same database in our application. so my questions are . 1.the database which is kept in app_code will work only with Sql Server Express Edition. 2.what will be my connection string in web.config. If any one can help out that will be appreciate and put some more light about using the data base in this way. or any article link will also appreciated.
Hiiiiiiiiiiii, Why my program can't access data base, if i'm not set permission & security to All User (Everyone)..?? FYI, my IIS setting for directory security is Basic Authentication. Pls advise how my program can access the program, if permission & security are not set to Everyone ?? Thanks
Hi We are building a portal internal to our org. Here, For one of the option on the portal, we have given each user in our organization an option to upload three images. Iam storing these images in Sql server table columns with datatype image.So, the question is: 1. Is it ok to store the images in sqlserver? Will it add any performance degradation? 2. Is it ok to store the images in folder and store the respective urls in the DB? Please let us know. Thanks! Santhosh
I'd be interested to know what the recommended methods are of implementing a SQL database using VS2005 standard and SQLExpress. I previously used VS2003 and MSDE which allowed me to create a .sql script to create and populate a database. Correct me if I'm wrong, but it now appears that in VS2005 the preferred way of doing this is to create a SQLExpress database in the App_Data folder. This is fine, except that I can't seem to connect to this 'detached' database using SQLCMD when I need to run my .sql scripts to create the tables. When I used MSDE, I used a command similar to the following: osql -E -S(local)etsdk -dMyDatabase Which connected to the 'MyDatabase' database. Now, with VS2005, if I create MyDatabase.mdf in the App_Data folder how would I connect to it using SQLCMD? I've tried: sqlcmd -E -S(local)SQLEXPRESS -dMyDatabase.mdf but this just tries to open a database in the SSQL.1MSSQLData folder. I guess I'd like to store the database in the App_Data folder as it keeps everything together and will be easier when deploying a site to a remote host. Thanks,Wayne.
Does anyone know if it is possible (and if yes, how) to create a trigger that creates a folder for every inserted record? In a specific root folder, I want a subfolder for every record in the table. How does the trigger have to look like to make the folder automatically with every insert of a new record???
Hi all, I have built a Disaster Recovery Site for my DB.on periodic basis, trn files from production server reach DR server and DR setup will apply them locally.
If the flow is smooth then no issues, if one of the file does not reach DR the entire setup will halt for the want of the file and I dn't have any means to know which file is missing.
Both my production and DR site located remotely behind firewalls, i.e i can't physically access the servers or remotely login to the server.
Can anyone tell me how to see the contents in a folder in the server using SQL query .
Is it possible to query a windows folder via t-sql?
A table will hold the possible file names of a set of files we receive each day. Is it possible to query the folder and match on the file names stored in t-sql to what is in the folder?
I have a folder which contains all the flat files which are used by all the packages(ex--flat file connection managers) in my project.
If we want to change the name of the folder(or)move the folder(path may change),have to change in every package( in all connection managers) manually.It looks hardcoding and timetaking.
Is there any way to change in one place(xml,file,variable) so that it should be affected in all the packages.