Copy Data To SQL Server By Checking (available)

Oct 1, 2001

Hello,

I connect from SQL Server on Windows 2000 to Progress
Database on UNIX.
The database name of SQL Server is cstarsql and the
name is cstarint on UNIX.

I would like to schedule to copy data from
cstarint(Progress) to cstarsql(SQLServer). I did for
one time, but I want to control if the data has
already copied or not. If not, it will copy.

In DTS Query Builder to copy from Progress to SQL
Server,
SELECT * from calls WHERE call_date = TODAY
The name of table of calls is the same for both
database.The above calls is cstarint(Progress
Database)
This command is enough for one time. But I need to
control if the record has already copied.


In SQL Server, I control if the record is available or
not with @@FETCH_STATUS .
Now I would like to mix two queries, but I couldn't.
Can anybody do this?

DECLARE calls_cursor SCROLL CURSOR
FOR SELECT * FROM calls
WHERE call_date = TODAY

OPEN calls_cursor

-- Perform the first fetch.
FETCH NEXT FROM calls_cursor

-- Check @@FETCH_STATUS to see if there are any more
rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch
succeeds.
FETCH NEXT FROM calls_cursor
END

CLOSE calls_cursor
DEALLOCATE calls_cursor

Alice

View 1 Replies


ADVERTISEMENT

Checking If Information Exists Before Copy

Apr 1, 2007

I am getting an error between the IF THEN Else statement. The copy works after the THEN! I need some help!

Ernie

I have two tables with script in a view. 1. newusers 2. blacklist I want to compare that "PresentEmail, RemoteComputer,Email" thats in newuser table is not in blacklists, and if this is true, then copy from newuser (the record not on blacklist) to blacklist using a where statement for second condition.

IF
(NOT EXISTS
(SELECT *
FROM newusers AS d
WHERE ISNULL(PresentEmail, 'NULL') IS BadEmail))


THEN

Insert into blacklist (BadNewEmail, BadIpAddress, BadEmail)

Select NewEmail, RemoteComputerName, PresentEmail

From newusers

Where Account_Active = 'Spammer'

Else
GO

View 7 Replies View Related

SQL Server 2014 :: Best Design For Multiple Validation Checking Of Data

Sep 17, 2015

I want to do something with error checking in my company. For this we have a selection of different tables and the data needs to meet various validation rules else it is classed as an error.

To deal with this I'm currently thinking of this approach:

1. Create a view pulling all of the various data together from the multiple tables.
2. Create an empty 'errors' data table.
3. Create an Excel file with a button to call a Check for Errors Script

Then in the the script:

1. Clear the 'errors' data table
2. Call multiple scripts, each of which uses the new view, applies the checks for that specific error and writes any erroring data into the 'errors' data table (along with a text string with the unique error code for filtering / sorting purposes).
3. After calling all the scripts, the table can be refreshed in excel when when used with a pivot table can show the various errors, and let us drill down into all the data so we can fix them.

Also.. Ideally, I'd like some way to write comments in an excel column for each entry and error code and be able to write that back into a comment table.

View 5 Replies View Related

Trigger For SQL Server 7 To Copy Data

Feb 7, 2003

When a user deletes a row from table "A", I would like to copy that row to table "B", so I can restore it if I need to.
TIA

View 7 Replies View Related

Sql Server Failed To Copy The Data

Aug 18, 2004

Hi,
I am trying to copy the data and tables from My server(SqlServer2000) to another Server(MSDE2000A) using DTS, after some time i am getting an Error " the login PDD Doc handler doesnot exist" failed to copy the data. How to fix this, appreciate your help
Thank You

View 1 Replies View Related

Copy SQL Data Structures From One Server To Another

Oct 17, 2007

Hello,
I have a sql database server (let call it server A) which has SQL program files installed on C:, and SQL data structures MSSQL (include subdirectories BAckup, DATA, FTDAT, JOBS, LOG, REPLDATA) on F:. A new server (call it server B) was cloned of server A but only at the C: partition. I still need to manually copy the SQL data structure on F: drive from A to B. The purpose of setting up server B is to test the restore of backup of server A and eventually want it to serve as the standby server should server A crashes. My questions are
1. Can MSSQL directory be copied from A to B without stopping the SQL server service on A first?
2. I will use robocopy for copying data over, what switches should I use to retain all database file security, permission, etc..
3. Currently I can not start the SQL service on server B because part of MSSQL directory is missing from the F: drive. so theorically, after I manually copy that folder over, I should be able to start the sql service. Am I right? Is there any steps that I might have overlook here. Any errors I might encounter doing it this way

Once I can get the sql started, I can take care of the restore part.
Thanks for any insights or suggestions you can provide on this.


View 7 Replies View Related

Copy Data From SQL Server To SQL Mobile

Jan 8, 2007

Hello

I'm developing an application that need to create everyday information to be stored in a SQL Mobile Database.

The SQL Mobile database will have:

Last schema from tables (in SQL Server database);
Last information in the tables;

I don't want to copy all the tables from SQL Server database than this mecanism should give me the way to choose the tables.

I have been reading about the SqlCeReplication but I don't undestand what is InternetUrl property. The SQL Mobile database is created in the PC and after is copy to the the Mobile Device.
How can I avoid the InternetURL property?

tkx in advance
Paulo Aboim Pinto
Odivelas - Portugal

View 1 Replies View Related

SQL Server Data Copy Problem

Apr 14, 2007

Hi,



I am facing a great problem. I have a DB about 80GB. There are 217489811 number of records which include 2005, 2006 and 2007 data in 1 table. Now I want to split the table into by quarter tables 2005Q1, 2005Q2.....etc. It is because it is easier for me to housekeep the old data. (It takes about few hours to housekeep 3 month data currently, so that it affect my server performance a lot)



so I start my work, however it is failed every times. Actually, if I copy 3 month data to a new tables, it is nearly about 30 million records which needs about 1 GB space. However, it takes about 8 hours to complete the job and failed because of not enough space allocated. Actually, my Server has about 50GB space, but when the job complete and fail, all the space is occupied. But i wonder why this happen because the data only need about 1 GB, how come it use 50GB?



it seems that nothing i can do to housekeep the old data. because housekeep the current table takes too long time while splitting tables use up all the space. So how can i do?



For your information, the table has non-clustered index on the data date field



need your help

thanks,

Linus

View 2 Replies View Related

SQL Server 2014 :: How To Copy Data Rows From Hosting To Local Server

Mar 11, 2015

I'm a web developer who writes transact-SQL to make my web applications run properly. I'm not real strong in other areas of SQL. Let me explain our set-up and then I'll explain what I want to do:

We have an ecommerce web site and all sales are saved in a SQL Server 2008 R2 database at our hosting company. We also have a local Windows 2012 network that has SQL Server 2014 Express installed.

Here is what I want to do:

I want to copy sales rows from the SQL Server 2008 database at our hosting company and save them in the SQL Server 2014 Express database on our local Windows 2012 server. I'd like to automate this if possible so that it happens each night perhaps. I know there is a way to schedule SQL jobs but I've never actually done this. I also would need to know how to attach to our hosting company DB as well as our local network DB.

View 2 Replies View Related

Copy Data In Sql Server Table A To B On Same Server - Identical Schemas

Dec 13, 2006

Greetings,

I have two SQL Server tables on the same server and in the same database. I'll call them table A and table B. They have identical schemas. I need to insert all rows in table A into table B. (Don't laugh - this is just for testing and long run the tables will reside on different servers.)

Can someone please tell me the correct task to use for this and the connection type I need for both the source and destination?

Thanks,

Black Cat Bone

View 9 Replies View Related

Data Checking?

Jul 23, 2005

Hey all,prolly a simple solution, but why isn't the following string working inmy execute sql step within DTS? It produces results, just not the onesI want... What am I doing wrong?select x from new_files where x like '%[^0-9]%' and x like '%[^a-z]%'It's displaying all the records? It should only be displaying thoserecords that do *not* contain letters or numbers.Thanks in advance!-Roy

View 3 Replies View Related

Copy Objects And Data Between SQL Server Databases

Jun 3, 2001

Copy objects and data between SQL Server databases
"
Display the Select Objects to Transfer dialog box, where you can specify both objects and data to copy, if both the data source and destination are Microsoft® SQL Server™ databases. The objects you can transfer include tables, views, stored procedures, defaults, rules, constraints, user-defined data types, logins, users, roles, and indexes. You can transfer objects only between multiple instances of SQL Server version 7.0, from an instance of SQL Server 7.0 to an instance of SQL Server 2000, and between multiple instances of SQL Server 2000.
"


can I apply "Copy objects and data between SQL Server databases"
to run in two different sqlserver 2000 ( not an instance ) . what I mean is I have two different sql servers located in two different locations( I am not using an instance installation) can I still run the copy and get an identical database in both servers.
Q2. if I have two sql server 2000 with different collations (one is binary and the other is the default) will I be able to run the copy wizard and still have an identical copy of sql server in both servers.

I personally tried to run the copy wizard and IT NEVER WORKED FOR ME and I really do not know the reason.

Thanks for your input.

ali

View 2 Replies View Related

Getiing A Copy Of Data Bse From A Remote Server

Jun 18, 2007

I am an authenticated user of a remote data base

I can log in and add tables and even I can back up the database .

Good.



But I want to get a copy of the database to my local computer

Is there any way to do this?





_sujithsql_

View 5 Replies View Related

[SQL SERVER 2005] Copy Data From One Database To Another On Same Server

Mar 29, 2007

Ok, here is my dilemma
I have an application that has many sites. Each site has it's own database. The databases have common tables (ie the name and fields are the same) What I want to be able to do is when creating a new database, I want to be able to copy certain common table data from one database to another. I have run into an error because the table have an IDENTITY so this is not working

INSERT INTO Containers SELECT * FROM ADMS2_Indian_Point.dbo.Containers

I also tried
USE ADMS2_RSCS
GO
SET IDENTITY_INSERT Containers ON
GO
INSERT INTO Containers SELECT * FROM ADMS2_Indian_Point.dbo.Containers
GO
SET IDENTITY_INSERT Containers OFF
GO

I got an error saying that I need to have a column list. I am trying to use this for any tables, so my question is this..
Is there any way to get around using a column list or is there a way to dynamically create the column list?
Or, Is there a better way that I should be doing this?

Please keep in mind I am not a dba and everything I have learned about SQL is from my good pal Google :)

Thanks for any help

View 3 Replies View Related

Copy Data From SQL Server Compact To SQL Server 2005

Oct 4, 2007

Is there a way to use SSIS to copy data from a SQLServer CE database to a SQL Server 2005 database?

I have a database that has only been used on a mobile device, but now I want to use it among several devices, so I want to copy the structure and data to a SQL Server 2005 database and expand it's scope.

View 3 Replies View Related

How To Copy The Data From One Server To Another Server Using Sql 2000 DTS Packages

Nov 12, 2007

I am trying to copy/update a table which is in server2 based on a similar table which is in server 1. I can't use replication,
so I am thinking which are the best ways to do without affecting the performance as the source table is busy with inserts or updates. I am thinking of following options:
1. SQL server 2000 DTS packages: As I am trying to copy the data from the source table(server1) into a destination table which is a similar table in server2, if I use dts first I want to take the complete snapshot and then on I only want to copy the new transactions or updated transactions, please let me know how I can do this.
2. Does trigger affect the performance as the server1(source table) is a busy server.
Please let me know. Thanks.

View 12 Replies View Related

Checking For No Data To Display

Oct 30, 2007

I am using a filter in a matrix control. I would like to display a "No data" type message if no data is present. The problem I'm running into is the base query is returning data, but the optional filter is removing all rows from display.

So using CountRows in the base dataset doesn't quite cut it. Is there an alternative?

View 4 Replies View Related

Copy Data From 1 Table To Other In Stored Procedure In Sql Server

Apr 15, 2004

Hi there,

Can u please tell me how to copy data from table A(database A) to table B(databaseB) which table A contain 10 fields but table B consist of 11 fields. I have to insert current date and time into another field in Table B (which has extra field compare to tableA) automatically every hour or so.
Please help.
Thanx

View 2 Replies View Related

SQL 2012 :: How To Copy Data From One Table On Remote Server A To B

Aug 12, 2015

how to copy a content of a table from one remote server to another,. server A does not see server B (B doesn't see A) - I cannot even ping to one from another.I do have SQL Studio installed on server C, which IT team configured to allow access to both A and B.So what I did so far is to periodically:

1. connect from the studio on server C to server A
2. run the following script on server A: SELECT * FROM A.myTable FOR XML PATH('ROOT')
3. copy the result
4. connect from the studio on server C to server B
5. to write something like

DECLARE @xmlData XML;
SET @xmlData = pasting here my result from item 3 above

6. INSERT INTO
SELECT

ref.value .....
FROM @xmlData.nodes('/myElemnet/ROOT')
xmlData( ref );

so it works. now there is a requirement to schedule this update to run periodically and I need to implement it..

View 9 Replies View Related

Missing Data Flow Items After Copy Into The New Sql Server

Feb 20, 2008

Hi... Please help. I am having problem with my hard drive so I git a new one. I installed a new instance of SQL Server 2005 and copy over all my projects from the old hard drive into the new.

The problem is, when I open my packages specifically the data flow task it is empty. All my dataflow items are gone.

I am not sure what I am missing during the copy. Please help how I can recover my complete packages.

Thanks a lot!

Concon

View 15 Replies View Related

Checking Out Data To Client Users

Sep 29, 2006

I'm trying to resolve an issue that I've run into in my current system.

I have about 10 clients accessing a SQL Server several times per minute (every 10-20 seconds). To have an individual find the next record, I follow the following process:

1. Select the value of the next record in the database to be checked out.
2. Update the record to show that it is checked out to the user.
3. Select the data in the record to display to the user.
3. Update the record to show any changes and to check the record back in after the user edits it.

My issue is that clients can execute at the same time. Right now, with just SQL statements, two clients can get the same value in step #1. That makes them select the same record for editing. Can I use T-SQL to prevent this from happening? If I use a transaction, will the SQL Server 2005 queue up the transactions, or could I still get the same problem of opening up the same record?

Thanks!
Drew

View 3 Replies View Related

Checking Data And Emailing The Results....

Jun 28, 2006

Hello,
 
I am trying to use €œSQL Server Business Intelligence Development Studio€? (what is the short name for this) to complete a check and then possibly email me depending on what happens.
 
The check is around two tables that I have. There is a chance that they will become out of sync with each other and so I want to know when a field (ACCOUNTID) has a value that is in one table and not the other. I can do the check but I would like the package to email me when there is a problem (and if possible email me the details) and do nothing when everything is OK.
 
Can anybody give me some hints to point me in the correct direction as I just seem to be chasing my tail at the moment,
 
Thanks,

View 5 Replies View Related

Copy Data To Excel File Using Dts Package In Sql Server 2000

Jul 26, 2007

Friends

Any one of you share your knowledge how to transfer data from a database to a excel using dts packages in sqlserver 2000.

I want clear steps how to create a dts package

Appreciate your help

Thanks
satish

View 1 Replies View Related

How Do I Copy The Index Statistics To A Development Database Server Without Data.

Jul 16, 2007



I want to be able to reproduce my production execution plans on development with copying data.

View 1 Replies View Related

StoredProc For Checking For Duplicates And Then Updating The Data.

Mar 22, 2008

Hi

I have a question i hope someone here will solve my problem.

I need a storedproc for checking the duplicates before updating the data.

here i need to pass four parameters to storedprocedure which must be updated with existing row.

but before updating the values. Storedproc should check for 2 colum values in all rows.

if same combination of colum values is present in any other row then the present rows which we tring to update should not be

updated. Can anyone help me with this.

Thankyou verymuch.

View 8 Replies View Related

Possible To Disable Welll-formedness Checking When Inserting XML Data.

Mar 20, 2006

Hi All,Can anyone help with the following problem? I have a database whichcontains a table with a 'text' field, and the text field contains anxml document - typically 50-100K. Now I'd like to make use of SQLServer 2005s XMLData type. To do this I have created a new field ofthe 'xmldata' datatype, and run an SQL statement to update the contentsfrom one field to another - hoping to end up with a complete table ofxml (based on the old text field).The problem I have is after a minute or so, it must come across anbadly-formed xml fragment because I get the following message:Msg 9436, Level 16, State 1, Line 1XML parsing: line 1, character 67640, end tag does not match start tagCan I turn off the checking during the update, or is it not possible toadd badly formed data to the xmldata field. Any help appreciated asthe table runs into tens of thousands of rows, so I can't really checkthe contents of each!Many thanks,Duncan.

View 1 Replies View Related

Checking Number Of CPU's On A Server

Feb 20, 2007

Hi

Will seem to be a basic question.

How can I check the number of CPU's used by a SQL Server.

Thanks

View 1 Replies View Related

Checking NT Logs From SQL Server Client

May 1, 2001

Dear All,
We have recently moved our NT boxes with SQL Server to
a new computer room 10 minutes walk away.
Is it possible to examine the NT error logs from a SQL
Server client using perhaps an xp command?

Many Thanks in Advance,
Andrew

View 1 Replies View Related

Checking The User's Server Role

Jul 23, 2005

I would like to determine if a particular user has sysadmin serverrole. Is there a way to do this via the connection string? Currentlyour code checks if a login is valid using SQLDriverConnect, however weneed to be certain that the user can login and modify the schema.Is it possible to fetch a user's server role to determine if it has asysadmin server role?

View 2 Replies View Related

Checking Server Connection Before A For Each Loop

Apr 9, 2008

I have a list of servers on a table, I take this list and pass to a for each loop container and that will grab some system information from each server that we give for our internal auditors.

The issue that I'm currently having with this package is that some times, 1 or 2 servers from the list are down and/or extremelly busy and it times out, either case causes the whole package to fail.

What I'm trying to do is, test the connection to the server prior passing the server name to the For Each Loop Container and log that information somewhere (Maybe a boolean field in a table), so then I check after the package finish and validate that the server was actually up or down.

Any ideas or suggestions?

Thanks,
Igor Santos

View 8 Replies View Related

Checking The Existance Of A File On An FTP Server

Oct 29, 2007

Hello guys,

Using SSIS, I want to check if a specific file exists on an FTP server or not. If yes, then i'll go with a flow, and if not, i'll go with another flow. Any help with that?

Thanks in advance

SHIKO

View 1 Replies View Related

Checking Linked Server Status

Oct 26, 2007

Is there a quick way to determine linked server availability. I've got some select statements wrapped up in TRY/Catch blocks which will re-direct any failures to retreive data from a linked server to the catch block and I can get my data from elsewhere, but I have to wait for the statement to fail before I can jump into the catch block. I hoped to speed the process up by using an if exists check on the status of the linked server . Is there such a thing as a quick check on whether or not a linked server is online?

THX

View 1 Replies View Related

Checking Server Availability When Using Dynamic Server/DB Names

Apr 15, 2008



I am building an SSIS package that is hitting about 50 remote servers. I have a for each loop container that i am using to build the list of servers to run.

The problem is...sometimes networks go down, sometimes connections time out and this causes my entire package to fail. I inserted a task that will run select @@ServerName on the remote server inside the loop. My thought was, if this returns an error I could ignore it and move on to the next server in the list and log somewhere that server x threw an error. Logging is easy, the problem is, how do I then tell it to move on to the next server in the loop?

If anyone has any suggestions on how better to do this, I am open for alternatives...

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved