Showing posts with label import. Show all posts
Showing posts with label import. Show all posts

Thursday, March 29, 2012

Convert ADP to MDB

My company uses Microsoft ADP to manage and display data. I am the
Business Analyst for the division, my manager has asked me to import
the ADP and convert it to MDB, so that we can modify queries to
generate more reports.
To give a little background on the issue, we have a "Form" that
performs a search in the "Tables" using the queries, and outputs that
results into and calendar format in excel. All this has been hard-coded
into the VB code. Basically, the "Form" runs the code, which in turn
runs a "Module".
Some of the queries were encrypted so I had to go in and make sense
out of it, and build similar queries in MDB. I have imported all the
necessary tables, queries, modules, macros, and forms. Since it was
custom built, I am having difficulty debugging the errors... Is there
any basic stuff I should look at before I start troubleshooting'
Please help!!You'd probably want to post this to an Access forum.
-oj
<jyesbrown@.gmail.com> wrote in message
news:1152210948.534715.165750@.m79g2000cwm.googlegroups.com...
> My company uses Microsoft ADP to manage and display data. I am the
> Business Analyst for the division, my manager has asked me to import
> the ADP and convert it to MDB, so that we can modify queries to
> generate more reports.
> To give a little background on the issue, we have a "Form" that
> performs a search in the "Tables" using the queries, and outputs that
> results into and calendar format in excel. All this has been hard-coded
> into the VB code. Basically, the "Form" runs the code, which in turn
> runs a "Module".
> Some of the queries were encrypted so I had to go in and make sense
> out of it, and build similar queries in MDB. I have imported all the
> necessary tables, queries, modules, macros, and forms. Since it was
> custom built, I am having difficulty debugging the errors... Is there
> any basic stuff I should look at before I start troubleshooting'
> Please help!!
>|||I am bit confused.
ADP is merely a front-end app of SQL Server/MSDE and does not contain
tables, queries. It only has forms, reports, macros/vba code modules. If you
want to modify/create queries in ADP (they are actually Views, SPs, UDF in a
SQL Server database), you are actually directly working in a SQL Server
database.
If your goal is to switch the front end app from ADP to an mdb with linked
table (to the SQL Server back end), because of not cleared future of ADP,
then converting ADP to MDB may make some sense, otherwise, I do not see why
to do it.
Also, the way ADP connects to SQL Server (bound controls, especially) is a
bit different from the way mbd linked table. And it may also be quite
different how the server side queries (views, sps...) are used. IMO, one
must be good at both Access programming and SQL Server programming in order
to fulfill the converting, if it has to be converted.
<jyesbrown@.gmail.com> wrote in message
news:1152210948.534715.165750@.m79g2000cwm.googlegroups.com...
> My company uses Microsoft ADP to manage and display data. I am the
> Business Analyst for the division, my manager has asked me to import
> the ADP and convert it to MDB, so that we can modify queries to
> generate more reports.
> To give a little background on the issue, we have a "Form" that
> performs a search in the "Tables" using the queries, and outputs that
> results into and calendar format in excel. All this has been hard-coded
> into the VB code. Basically, the "Form" runs the code, which in turn
> runs a "Module".
> Some of the queries were encrypted so I had to go in and make sense
> out of it, and build similar queries in MDB. I have imported all the
> necessary tables, queries, modules, macros, and forms. Since it was
> custom built, I am having difficulty debugging the errors... Is there
> any basic stuff I should look at before I start troubleshooting'
> Please help!!
>|||Thanks for your reponse. I am not an expert on VB and SQL programming.
So I'm taking a different approach. To keep things simple, I have three
tables (in MDB), so I created a query that draws required information
from the tables and puts the data in a calendar format in 'Access
Report' (I made a calendar for July, with Text Boxes for each day of
the month).
Problem: The calendar displays only one record per page, it was
supposed to display all the records corresponding to the days of the
month in one page. Also, is there a way to display more than one record
in the 'Text box'?, as of now it only displays one record in each 'text
box' in each page.
Please help!!!!!!!!!!|||jyesbrown@.gmail.com wrote:
> Thanks for your reponse. I am not an expert on VB and SQL programming.
> So I'm taking a different approach. To keep things simple, I have three
> tables (in MDB), so I created a query that draws required information
> from the tables and puts the data in a calendar format in 'Access
> Report' (I made a calendar for July, with Text Boxes for each day of
> the month).
> Problem: The calendar displays only one record per page, it was
> supposed to display all the records corresponding to the days of the
> month in one page. Also, is there a way to display more than one record
> in the 'Text box'?, as of now it only displays one record in each 'text
> box' in each page.
> Please help!!!!!!!!!!
>
I think you need to seek help in one of the Access groups, these sound
like questions specific to Access, not SQL Server. It also sounds like
you're in over your head, why did you agree to do something like this
without having a clue how?
Tracy McKibben
MCDBA
http://www.realsqlguy.comsqlsql

Sunday, March 25, 2012

Conversion issues in importing DBF in SQL 2000

Hello!
I try to import a DBF file into my Microsoft SQL Server 2000 database and I
have some issues with corrupted data. I actually have stored in my DBF
records with different languages, such as German or French, for which I used
some special characters (accents, ?, ..).
When I import my DBF file, I got no error but when I look at the data, the
strange characters have not been converted and I got errors in place of them
.
What can I do to make sure my import respects the integrity of my data?
I was using the standard Microsft DBF driver and I have tested the Advantage
Databaser Server driver as well. Same results unfortunately.
Many thanks for your help.
Regards,
BertFor national characters you need the unicode datatype. Look up 'nchar',
'nvarchar' and 'ntext' in Books Online. Also the use of unicode is well
explained in Books Online.
ML|||Thank you for your note.
Could you please help me once more? It sounds like Books Online is a place
on the web you know about, but this is not my case. Which website could I
consult to know more about the local unicode?
If I understand it right, I need to replace all the characters, is it exact?
Does SQL Server 2000 do not convert these characters automatically?
Thanks.
Bert
"ML" wrote:

> For national characters you need the unicode datatype. Look up 'nchar',
> 'nvarchar' and 'ntext' in Books Online. Also the use of unicode is well
> explained in Books Online.
>
> ML|||Unicode is an universal standard: http://www.unicode.org/
Books Online are available on-line: http://www.msdn.microsoft.com/sql/
and can also be installed locally:
http://www.microsoft.com/downloads/...&DisplayLang=en
To store data as unicode, the data must be created as unicode in the client
application. Look it up in your programming language reference.
ML

Thursday, March 22, 2012

Conversion from 7 to 2K

Hi
Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
anymore). Now I have setup SQL 2000, how can I convert/import these files
into SQL2K.
ThanksHi,
Make a copy of MDF and LDF files, and then try attach them to the SQL Server
2000 instance.
SQL Server 2000 will attach the detached SQL Server 7.0 database files and
automatically convert them into SQL Server 2000 format.
Note:-
This process might fail incase if the SQL 7 files were not detached
properly.
Thanks
Hari
SQL Server MVP
"Kelly" <Kelly@.discussions.microsoft.com> wrote in message
news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
> Hi
> Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
> anymore). Now I have setup SQL 2000, how can I convert/import these files
> into SQL2K.
> Thanks
>|||It worked. Thanks.
"Hari Prasad" wrote:

> Hi,
> Make a copy of MDF and LDF files, and then try attach them to the SQL Serv
er
> 2000 instance.
> SQL Server 2000 will attach the detached SQL Server 7.0 database files and
> automatically convert them into SQL Server 2000 format.
> Note:-
> This process might fail incase if the SQL 7 files were not detached
> properly.
> Thanks
> Hari
> SQL Server MVP
> "Kelly" <Kelly@.discussions.microsoft.com> wrote in message
> news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
>
>

Conversion from 7 to 2K

Hi
Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
anymore). Now I have setup SQL 2000, how can I convert/import these files
into SQL2K.
ThanksHi,
Make a copy of MDF and LDF files, and then try attach them to the SQL Server
2000 instance.
SQL Server 2000 will attach the detached SQL Server 7.0 database files and
automatically convert them into SQL Server 2000 format.
Note:-
This process might fail incase if the SQL 7 files were not detached
properly.
Thanks
Hari
SQL Server MVP
"Kelly" <Kelly@.discussions.microsoft.com> wrote in message
news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
> Hi
> Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
> anymore). Now I have setup SQL 2000, how can I convert/import these files
> into SQL2K.
> Thanks
>|||It worked. Thanks.
"Hari Prasad" wrote:
> Hi,
> Make a copy of MDF and LDF files, and then try attach them to the SQL Server
> 2000 instance.
> SQL Server 2000 will attach the detached SQL Server 7.0 database files and
> automatically convert them into SQL Server 2000 format.
> Note:-
> This process might fail incase if the SQL 7 files were not detached
> properly.
> Thanks
> Hari
> SQL Server MVP
> "Kelly" <Kelly@.discussions.microsoft.com> wrote in message
> news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
> > Hi
> > Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
> > anymore). Now I have setup SQL 2000, how can I convert/import these files
> > into SQL2K.
> >
> > Thanks
> >
>
>

Conversion from 7 to 2K

Hi
Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
anymore). Now I have setup SQL 2000, how can I convert/import these files
into SQL2K.
Thanks
Hi,
Make a copy of MDF and LDF files, and then try attach them to the SQL Server
2000 instance.
SQL Server 2000 will attach the detached SQL Server 7.0 database files and
automatically convert them into SQL Server 2000 format.
Note:-
This process might fail incase if the SQL 7 files were not detached
properly.
Thanks
Hari
SQL Server MVP
"Kelly" <Kelly@.discussions.microsoft.com> wrote in message
news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
> Hi
> Have mdf, ldf files from SQL 7.0 (just files, SQL 7 server is not there
> anymore). Now I have setup SQL 2000, how can I convert/import these files
> into SQL2K.
> Thanks
>
|||It worked. Thanks.
"Hari Prasad" wrote:

> Hi,
> Make a copy of MDF and LDF files, and then try attach them to the SQL Server
> 2000 instance.
> SQL Server 2000 will attach the detached SQL Server 7.0 database files and
> automatically convert them into SQL Server 2000 format.
> Note:-
> This process might fail incase if the SQL 7 files were not detached
> properly.
> Thanks
> Hari
> SQL Server MVP
> "Kelly" <Kelly@.discussions.microsoft.com> wrote in message
> news:6E42776C-61BB-4D7D-9ABC-DBCD2DE1076F@.microsoft.com...
>
>

Monday, March 19, 2012

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
Greg
What recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Sunday, March 11, 2012

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
GregWhat recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
--
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Controlling log file size

What's the best practice to keep log file size low. I have some databases
that run DTS packages to import data every night. The logs get huge, 17
gigs. I have an Arcserve agent backing them up, but it does not seem to
shrink them.
Any ideas?
Thanks
GregWhat recovery model are you using? Do you care about your transaction logs?
If you don't care about the data within the logs you can set your recovery
model to simple. You can also perform a BACKUP LOG <databasename> WITH
NO_LOG between each export to clear the transaction log.
NOTE: these steps will break transaction log backup/restore. Make sure that
you know what you are doing and how it will impact your database backups
before setting the recovery model or truncating the transaction log.
Keith
"Greg Richards" <grichards@.matrixwebs.com> wrote in message
news:uyL9M0FYEHA.3520@.TK2MSFTNGP10.phx.gbl...
> What's the best practice to keep log file size low. I have some databases
> that run DTS packages to import data every night. The logs get huge, 17
> gigs. I have an Arcserve agent backing them up, but it does not seem to
> shrink them.
> Any ideas?
> Thanks
> Greg
>

Sunday, February 19, 2012

Consuming Error Output from a Derived column component

Hi,

I have created a program that imports a csv into the sql server. but during that import I need to track all the errors that occured for some malformed rows. I think I need to use the error output collection of the dataflow components to track the errors. I figured out that every dataflow component has a error output collection along with the data output collection. I want to write those error outputs into a separete database. So, I have created a SQL server data destination component and created a path between derived columns error output and it input collection. But it is not working as expected. can any body help on this?

or can anyone give me any example how to use/handle error output collection in SSIS?

I will appreciate all kind of suggestions.

thanks

Why is it not working? Are you receiving any errors? What are those errors?|||

Give more details...

What is the error?

Tuesday, February 14, 2012

Constraints?

I am importing data from a .csv. I have noticed that it copies this
information over and over when I import the data. I only want it to update
anything that is different and add any new lines in the .csv file. I have
looked at setting up a primary key but this won't work.
ProjectID, Phase, Unit,Tract, Release, UnitPlan, UnitOpt
As long as one of these fields is different I want it to allow it to be
entered. My problem is some of them may be null. Which is ok.
KB5IR,10,405,,,4516,,
KB5IR,10,406,,4516,REV,
I am not sure how to go about doing this!
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200603/1brenenger via webservertalk.com wrote:
> I am importing data from a .csv. I have noticed that it copies this
> information over and over when I import the data. I only want it to update
> anything that is different and add any new lines in the .csv file. I have
> looked at setting up a primary key but this won't work.
> ProjectID, Phase, Unit,Tract, Release, UnitPlan, UnitOpt
> As long as one of these fields is different I want it to allow it to be
> entered. My problem is some of them may be null. Which is ok.
> KB5IR,10,405,,,4516,,
> KB5IR,10,406,,4516,REV,
> I am not sure how to go about doing this!
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200603/1
Do you have an existing data model or are you designing one? Don't make
the mistake of trying to mimic a file in a table. Relational design
principles and file storage are not the same!
Assuming you have or create a suitably normalized data model there are
basically 2 possible approaches:
1. Transform the file as you load it to the normalized schema (using
DTS or Integration Services or some other tool for example)
2. Load the file as-is to an intermediate "staging" table and then
transform the data to your real data model using SQL. The staging table
isn't used for anything other than the load process and the data is
usually deleted some time afterwards.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Here are a couple of options to look at-
use of a unique index with the ignore dupe option (it will just not enter
the data for duplicate insert attempts) . This would not work with the
updates you mention however. Another option would be to import into a load
table then use a procedure containing the merge logic to update/insert as
appropriate.
HTH
--Tony
"brenenger via webservertalk.com" wrote:

> I am importing data from a .csv. I have noticed that it copies this
> information over and over when I import the data. I only want it to update
> anything that is different and add any new lines in the .csv file. I have
> looked at setting up a primary key but this won't work.
> ProjectID, Phase, Unit,Tract, Release, UnitPlan, UnitOpt
> As long as one of these fields is different I want it to allow it to be
> entered. My problem is some of them may be null. Which is ok.
> KB5IR,10,405,,,4516,,
> KB5IR,10,406,,4516,REV,
> I am not sure how to go about doing this!
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200603/1
>|||Hi everyone. I am sorry about this. I am VERY new to SQL and I am having a
hard time trying to figure out what to do. I got Access configured to link t
o
SQL Server and I think I'll be able to get the rest of this figured out. My
only problem now is the import. I need to UPDATE/INSERT the .csv information
.
Here is the transformation that I got help creating.
Function Main()
IF DTSSource("Col001") <>0 Then
' add a 0 to the front, and keep only the 6 right characters.
'21706 -> 021706 -> 021706
'100106 -> 0100106 -> 100106
str = DTSSource("Col001")
iMo = CInt( Mid( str, 1, 1) )
iDay = CInt( Mid( str, 2, 2) )
iYear = CInt( Mid( str, 4, 2) )
DTSDestination("DelDate") = DateSerial( iYear, iMo, iDay)
Else
'This will not return a value for the date
'which means it will be NULL if the col001 = "0"
'If you want to specify a date then uncomment the next line
'DTSDestination("DelDate") = "19000101"
End If
DTSDestination("ProjectID") = DTSSource("Col002")
DTSDestination("Phase") = DTSSource("Col003")
DTSDestination("Unit") = DTSSource("Col004")
If DTSSource("Col005") = Null Then
DTSDestination ("Tract") = " "
Else
End If
If DTSSource("Col006") = Null Then
DTSDestination ("Release") = " "
Else
End IF
DTSDestination("UnitPlan") = DTSSource("Col007")
DTSDestination("UnitOpt") = DTSSource("Col008")
DTSDestination("POComp") = DTSSource("Col009")
DTSDestination("PrjFrm") = DTSSource("Col010")
DTSDestination("OrderNo") = DTSSource("Col011")
DTSDestination("OrderStat") = DTSSource("Col012")
DTSDestination("Boxes") = DTSSource("Col013")
Main = DTSTransformStat_OK
End Function
I cannot create a PK because I can have null values. As long as ProjectID,
Phase, Unit, Tract, Release, UnitPlan, UnitOpt are unique all together it
should be ok. Here is an example of what my .csv looks like. I need to be
able to import this periodically. I would like for it to update anything tha
t
has changed and insert anything that is missing. The way it is now, it just
adds the import to the table. So I could have this stuff listed over and ove
r.
Which I don't want.
21706 KBMP NEW 200 2031 Y Y 64149 SCHED 17
21706 KBMP NEW 201 2031 Y Y 64150 SCHED 8
21706 KBMP NEW 201 2031 OPT04 Y Y 64151 SCHED 13
21706 KBMP NEW 201 2031 OPT136 Y Y 64151 SCHED 0
21706 KBMP NEW 201 2031 OPT142 Y Y 64151 SCHED 0
21706 KBMP NEW 201 2031 OPT143 Y Y 64151 SCHED 0
21706 KBMP NEW 201 2031 OPT144 Y Y 64151 SCHED 0
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200603/1|||brenenger via webservertalk.com wrote:
> Hi everyone. I am sorry about this. I am VERY new to SQL and I am having a
> hard time trying to figure out what to do. I got Access configured to link
to
> SQL Server and I think I'll be able to get the rest of this figured out. M
y
> only problem now is the import. I need to UPDATE/INSERT the .csv informati
on.
> Here is the transformation that I got help creating.
> Function Main()
> IF DTSSource("Col001") <>0 Then
> ' add a 0 to the front, and keep only the 6 right characters.
> '21706 -> 021706 -> 021706
> '100106 -> 0100106 -> 100106
> str = DTSSource("Col001")
> iMo = CInt( Mid( str, 1, 1) )
> iDay = CInt( Mid( str, 2, 2) )
> iYear = CInt( Mid( str, 4, 2) )
> DTSDestination("DelDate") = DateSerial( iYear, iMo, iDay)
> Else
> 'This will not return a value for the date
> 'which means it will be NULL if the col001 = "0"
> 'If you want to specify a date then uncomment the next line
> 'DTSDestination("DelDate") = "19000101"
> End If
>
> DTSDestination("ProjectID") = DTSSource("Col002")
> DTSDestination("Phase") = DTSSource("Col003")
> DTSDestination("Unit") = DTSSource("Col004")
> If DTSSource("Col005") = Null Then
> DTSDestination ("Tract") = " "
> Else
> End If
> If DTSSource("Col006") = Null Then
> DTSDestination ("Release") = " "
> Else
> End IF
> DTSDestination("UnitPlan") = DTSSource("Col007")
> DTSDestination("UnitOpt") = DTSSource("Col008")
> DTSDestination("POComp") = DTSSource("Col009")
> DTSDestination("PrjFrm") = DTSSource("Col010")
> DTSDestination("OrderNo") = DTSSource("Col011")
> DTSDestination("OrderStat") = DTSSource("Col012")
> DTSDestination("Boxes") = DTSSource("Col013")
> Main = DTSTransformStat_OK
> End Function
> I cannot create a PK because I can have null values. As long as ProjectID,
> Phase, Unit, Tract, Release, UnitPlan, UnitOpt are unique all together it
> should be ok. Here is an example of what my .csv looks like. I need to be
> able to import this periodically. I would like for it to update anything t
hat
> has changed and insert anything that is missing. The way it is now, it jus
t
> adds the import to the table. So I could have this stuff listed over and o
ver.
> Which I don't want.
>
> 21706 KBMP NEW 200 2031 Y Y 64149 SCHED 17
> 21706 KBMP NEW 201 2031 Y Y 64150 SCHED 8
> 21706 KBMP NEW 201 2031 OPT04 Y Y 64151 SCHED 13
> 21706 KBMP NEW 201 2031 OPT136 Y Y 64151 SCHED 0
> 21706 KBMP NEW 201 2031 OPT142 Y Y 64151 SCHED 0
> 21706 KBMP NEW 201 2031 OPT143 Y Y 64151 SCHED 0
> 21706 KBMP NEW 201 2031 OPT144 Y Y 64151 SCHED 0
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200603/1
I think the easiest approach will be to load this data to a temporary
staging table that matches the file structure. Then use UPDATE and
INSERT statements to load the data into actual table(s) in your
database. In the staging table you can use a file name, date and/or row
number as the key.
You will find it VERY hard and maybe even impossible to maintain the
integrity of the changing data unless you first implement the correct
data model with keys in each table. I can't help you to do that just
based on a list of column names and a snapshot of your data file. The
data model should be based on your business rules and knowledge of your
business environment. There is little point in basing your data model
on the format that happens to have been used in this file.
If you don't already know about relational design principles like
Normalization and the normal forms then you should master those
concepts before you attempt a final design.
On the other hand if you don't care about design right now and just
want to see some data in a table then you could create a unique index
on all columns using the IGNORE_DUP_KEY option. That will eliminate any
duplicates but won't help you any further than that:
CREATE UNIQUE NONCLUSTERED INDEX idx_tbl
ON tbl (col1, col2, col3)
WITH IGNORE_DUP_KEY ;
IMPORTANT: I do NOT recommend this for a live production environment.
Hope this helps.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Ok. I am importing a .csv file in it's own table. I want this table to be
overwritten each time it is updated. I am using DTS to import. Once this
table is populated, I need to run a Stored Procedure that will look at that
table and tblUnitImport. This is the code I have so far, I am not sure if I
am doing this right. If the row is not listed in tblUnitImport then I need t
o
INSERT it, otherwise I need to update the DELDATE and/or ORDERSTAT field if
it is different in m#ds001o1. Am I on the right track?
BEGIN INSERT INTO tblUnitImport
(Deldate, ProjectID, Phase, Unit, Tract,
Release, UnitPlan, UnitOpt, POComp, PrjFrm, OrderNo, OrderStat, Boxes)
SELECT Col001, Col002, Col003,Col004, Col005, Col006,
Col007, Col008, Col009, Col010, Col011, Col012, Col013
FROM m#ds001o1 AS M
WHERE NOT EXISTS
(SELECT *
FROM tblUnitImport
WHERE tblUnitImport.
ProjectId = m#ds001o1.Col002
tblUnitImport.
Phase = m#ds001o1.Col003
tblUnitImport.
Unit = m#ds001o1.Col004
tblUnitImport.
Tract = m#ds001o1.Col005
tblUnitImport.
Release = m#ds001o1.Col006
tblUnitImport.
UnitPlan = m#ds001o1.Col007
tblUnitImport.
UnitOpt = m#ds001o1.Col008);
UPDATE tblUnitImport
SET col1 =
(SELECT
col001, col012
FROM
m#ds001o1
WHERE
tblUnitImport.ProjectId = m#ds001o1.Col002
tblUnitImport.Phase = m#ds001o1.Col003
tblUnitImport.Unit = m#ds001o1.Col004
tblUnitImport.Tract = m#ds001o1.Col005
tblUnitImport.Release = m#ds001o1.Col006
tblUnitImport.UnitPlan = m#ds001o1.Col007
tblUnitImport.UnitOpt = m#ds001o1.Col008)
WHERE EXISTS
(SELECT
*
FROM
Foobar
WHERE
Foobar.keycol = Merge_table.keycol); END;
Message posted via http://www.webservertalk.com