Showing posts with label directory. Show all posts
Showing posts with label directory. Show all posts

Wednesday, March 28, 2012

receive files from remote site only if file does not exist in local directory

I need to only receive files via ftp when the file does not exist on my local machine. FIles are being added to the remote location on a weekly basis and they are being downloaded locally. I do not want to download all the files each time. Instead, just download what was not already downloaded. Is there a way to do this? I want to do this using SSIS / ftp task.

Thanks in advance.

One way to accomplish this is to use the Execute Process task to run ftp.exe to get a list of the files on the server, then compare that list to your local directory. You could compare the file lists through a script task. Then FTP each file that you need to pull down.|||Thanks very much. I will try that.

Monday, March 26, 2012

RebuildM: Cannot copy file error?

Hi All,
I tried to rebuild my Master data file unsuccessfully. After selecting the
directory where my Master.dbf and .ldf, I clicked on the Rebuild button, and
RebuildM gives me the following error message:
Cannot copy Master: There has been a sharing violation.
The source or destination file may be in use.
I am not so sure which one is source, which one is destination? I tried to
delete and restore the master.ldf and master.mdf files and they are deleted
and restored fine, which means that they are not in use.
What else do I have to do in order to rebuild the master file?Hi, David,
From you information, when you use the rebuildm.exe to rebuild the master
database, you encoutere error message of:
Cannot copy Master: There has been a sharing violation.
The source or destination file may be in use.
Based on my knowledge, The Rebuild Master utility reinstalls the master
database. Rebuilding the master database removes all database objects and
data. After rebuilding the master database, re-create the database objects
and reload the data, or reattach the data and log files using sp_attach_db.
Please refer to the following articles before you run it.
Rebuild master Utility
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp
_rebuildm_6dbt.asp
How to rebuild the master database (Rebuild Master utility)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/howtosql/ht
_install_8w8p.asp
You should choose the resorce by click on the browse button and Select the
\Data folder on the SQL Server compact disc or in the shared network
directory from which SQL Server was installed, and then click OK.
Hope this helps.
Best regards
Baisong Wei
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.|||H
before use the rebuildm.exe, copy SQL Server install CD to hard disk, and remove Read Only flag from files
JBandi|||Hi, David,
I am reviewing you post. Since we have not heard from you in he newsgroup
for some days, I want to know if you have problem resolved or there is any
question that need our assistance. For any question, please feel free to
post here and we are glad to help. Thanks.
Best regards
Baisong Wei
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.

Friday, March 9, 2012

Reattaching System Databases

I had to uninstall a SQL Server 2000 installation. Before I uninstalled it
I copied the Data directory to a different drive. After I reinstalled it I
copied my user databases back to the new Data directory and re-attached
them. My problem is I can not find a way copy the system databases back to
the new Data directory to re-attach them. I tried it with the Master.mdf
after shuting down SQL Server, but it wouldn't start back up. I do not have
a backup to restore from, only the .mdf and ldf files.
Is there a way to attach the old sytem database mdf and ldf files to the new
SQL Server installation.
Thanks
MikeAs a last ditch attempt, you could attach them as another database, perform a backup of the new database and then restore the master with the backup.|||Hi,
Instead of attaching the User databases perform the below steps,
After installation perform ,
1. Stop the SQL Server / SQL Agent service
2. Move all the new MDF and LDF to a new location (System databases)
3. Copy all the old MDF and LDF files back to the old location where the
files resides previously (Includes old System databases)
4. Start SQL server back
Thanks
Hari
MCDBA
"M Smith" <msmith@.avma.org> wrote in message
news:ONhB#8xzDHA.1740@.TK2MSFTNGP12.phx.gbl...
> I had to uninstall a SQL Server 2000 installation. Before I uninstalled
it
> I copied the Data directory to a different drive. After I reinstalled it
I
> copied my user databases back to the new Data directory and re-attached
> them. My problem is I can not find a way copy the system databases back
to
> the new Data directory to re-attach them. I tried it with the Master.mdf
> after shuting down SQL Server, but it wouldn't start back up. I do not
have
> a backup to restore from, only the .mdf and ldf files.
> Is there a way to attach the old sytem database mdf and ldf files to the
new
> SQL Server installation.
> Thanks
> Mike
>

Saturday, February 25, 2012

Really dumb Stored Proc Question. But I need help and Im lost.

Right now, I'm working on the database of a new project. The project is basically a keyword tracking and referral tracking website directory. My plan is to give the website some java code that will allow me to grab the http_referer and request_uri per page load. (everytime they get traffic)

Right now, I've got some tables I think will work fine. One is the storage table, where I'll store what the javascript grabs.

table.http_ref (columns will be)
uid (Unique ID)
http_referer
request_uri

Then I got the results page I want to parse the http_ref table into. For example.

Here we have a google results page which is a search for baby shoes. This would be the http_referer

http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGGL_enUS177US177&q=baby+shoes

And if someone clicks on a link get this page, which let's say I'm tracking in my project.
http://www.thebabymarketplace.com/securestore/c54581.2.html

in my http_ref table I will have
uid
(whatever)
http_referer
http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGGL_enUS177US177&q=baby+shoes
request_uri
http://www.thebabymarketplace.com/securestore/c54581.2.html

so I want a stored proc to grab the http_referer column and parse it for the refering search engine
http://www.google.com
and the key words
search?sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGGL_enUS177US177&q=baby+shoes

Then grab the uri_request, which should be the web page visited,
and INSERT into another table where I will hold
keywords
referer
refered page

Any suggestions? I've been going nuts over this.

Then the key point is to parse the http_referer. You should gurantee that all http_referer strings are in a same format, for example the search string begins with '/search?' and the keywords start with '&q=' and locate the end of the string. Then you can use such procedure:


CREATE PROC sp_ParseHttpRef
AS
INSERT INTO Tbl_Parsed
SELECT SUBSTRING(HttpReferer,1,CHARINDEX('/search?',HttpReferer)-1),
RIGHT(HttpReferer,LEN(HttpReferer)-(CHARINDEX('&q=',HttpReferer,CHARINDEX('/search?',HttpReferer))+LEN('&q=')-1)),
Request_URI
FROM Tbl_SourceHttp
go


|||

Thank you very much.

So, can I take this proc and use it as a template to track other search engine referer strings?

For instance:

MSN

http://search.msn.com/results.aspx?q=baby+shoes&FORM=SSRE

or Yahoo

http://search.yahoo.com/search?p=baby+shoes&sm=Yahoo%21+Search&fr=FP-tab-web-t&toggle=1&cop=&ei=UTF-8

and create a Proc for each search engine I'm tracking?

Seems as if I would then have to Schedule the proc's to run, our just call them when I grab the http_referer and request_uri?

|||

Sure you can use the sample as a template, just keep in mind to parse the http_referer correctly. You do not need to schedule the proc to run, you can call it when you grab the http_refer and request_uri in your application, or you can make the proc as an insert trigger on the table which stores the http_refer and request_uri. For example:

create trigger trg_ParseHttp on Tbl_SourceHttp for insert
as
insert into Tbl_Parsed
SELECT SUBSTRING(HttpReferer,1,CHARINDEX('/search?',HttpReferer)-1),
RIGHT(HttpReferer,LEN(HttpReferer)-(CHARINDEX('&q=',HttpReferer,CHARINDEX('/search?',HttpReferer))+LEN('&q=')-1)),
Request_URI
FROM inserted
go