I have a table called cr. Within that table I have the colums c_id, c_type, first_name, last_name. I need help creating a query that will pull from an excel file that have the same colum names. This excel file is automaticaly generated from one of our sys
tems and the c_id will never change for the record.
So this is what im wanting to do. I need it to look at the xls file and if there are new records in that xls file it will add those to the table or if the records have changed it will update the records within the table based on the c_id. I think this is
feasable but I can't seem to get it to work. And example would be great.
Thanks
Eric
1) DTS package
2) SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> I have a table called cr. Within that table I have the colums c_id,
c_type, first_name, last_name. I need help creating a query that will pull
from an excel file that have the same colum names. This excel file is
automaticaly generated from one of our systems and the c_id will never
change for the record.
> So this is what im wanting to do. I need it to look at the xls file and if
there are new records in that xls file it will add those to the table or if
the records have changed it will update the records within the table based
on the c_id. I think this is feasable but I can't seem to get it to work.
And example would be great.
> Thanks
|||and that will insert or update any records?
THanks
"Uri Dimant" wrote:
> Eric
> 1) DTS package
> 2) SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="c:\MyExcel.xls";
> User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
>
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> c_type, first_name, last_name. I need help creating a query that will pull
> from an excel file that have the same colum names. This excel file is
> automaticaly generated from one of our systems and the c_id will never
> change for the record.
> there are new records in that xls file it will add those to the table or if
> the records have changed it will update the records within the table based
> on the c_id. I think this is feasable but I can't seem to get it to work.
> And example would be great.
>
>
sql
Showing posts with label first_name. Show all posts
Showing posts with label first_name. Show all posts
Friday, March 23, 2012
Newbie Question
I have a table called cr. Within that table I have the colums c_id, c_type,
first_name, last_name. I need help creating a query that will pull from an e
xcel file that have the same colum names. This excel file is automaticaly ge
nerated from one of our sys
tems and the c_id will never change for the record.
So this is what im wanting to do. I need it to look at the xls file and if t
here are new records in that xls file it will add those to the table or if t
he records have changed it will update the records within the table based on
the c_id. I think this is
feasable but I can't seem to get it to work. And example would be great.
ThanksEric
1) DTS package
2) SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> I have a table called cr. Within that table I have the colums c_id,
c_type, first_name, last_name. I need help creating a query that will pull
from an excel file that have the same colum names. This excel file is
automaticaly generated from one of our systems and the c_id will never
change for the record.
> So this is what im wanting to do. I need it to look at the xls file and if
there are new records in that xls file it will add those to the table or if
the records have changed it will update the records within the table based
on the c_id. I think this is feasable but I can't seem to get it to work.
And example would be great.
> Thanks|||and that will insert or update any records?
THanks
"Uri Dimant" wrote:
> Eric
> 1) DTS package
> 2) SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="c:\MyExcel.xls";
> User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
>
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> c_type, first_name, last_name. I need help creating a query that will pull
> from an excel file that have the same colum names. This excel file is
> automaticaly generated from one of our systems and the c_id will never
> change for the record.
> there are new records in that xls file it will add those to the table or i
f
> the records have changed it will update the records within the table based
> on the c_id. I think this is feasable but I can't seem to get it to work.
> And example would be great.
>
>
first_name, last_name. I need help creating a query that will pull from an e
xcel file that have the same colum names. This excel file is automaticaly ge
nerated from one of our sys
tems and the c_id will never change for the record.
So this is what im wanting to do. I need it to look at the xls file and if t
here are new records in that xls file it will add those to the table or if t
he records have changed it will update the records within the table based on
the c_id. I think this is
feasable but I can't seem to get it to work. And example would be great.
ThanksEric
1) DTS package
2) SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> I have a table called cr. Within that table I have the colums c_id,
c_type, first_name, last_name. I need help creating a query that will pull
from an excel file that have the same colum names. This excel file is
automaticaly generated from one of our systems and the c_id will never
change for the record.
> So this is what im wanting to do. I need it to look at the xls file and if
there are new records in that xls file it will add those to the table or if
the records have changed it will update the records within the table based
on the c_id. I think this is feasable but I can't seem to get it to work.
And example would be great.
> Thanks|||and that will insert or update any records?
THanks
"Uri Dimant" wrote:
> Eric
> 1) DTS package
> 2) SELECT *
> FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
> 'Data Source="c:\MyExcel.xls";
> User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
>
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> c_type, first_name, last_name. I need help creating a query that will pull
> from an excel file that have the same colum names. This excel file is
> automaticaly generated from one of our systems and the c_id will never
> change for the record.
> there are new records in that xls file it will add those to the table or i
f
> the records have changed it will update the records within the table based
> on the c_id. I think this is feasable but I can't seem to get it to work.
> And example would be great.
>
>
Newbie Question
I have a table called cr. Within that table I have the colums c_id, c_type, first_name, last_name. I need help creating a query that will pull from an excel file that have the same colum names. This excel file is automaticaly generated from one of our systems and the c_id will never change for the record.
So this is what im wanting to do. I need it to look at the xls file and if there are new records in that xls file it will add those to the table or if the records have changed it will update the records within the table based on the c_id. I think this is feasable but I can't seem to get it to work. And example would be great.
ThanksEric
1) DTS package
2) SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> I have a table called cr. Within that table I have the colums c_id,
c_type, first_name, last_name. I need help creating a query that will pull
from an excel file that have the same colum names. This excel file is
automaticaly generated from one of our systems and the c_id will never
change for the record.
> So this is what im wanting to do. I need it to look at the xls file and if
there are new records in that xls file it will add those to the table or if
the records have changed it will update the records within the table based
on the c_id. I think this is feasable but I can't seem to get it to work.
And example would be great.
> Thanks
So this is what im wanting to do. I need it to look at the xls file and if there are new records in that xls file it will add those to the table or if the records have changed it will update the records within the table based on the c_id. I think this is feasable but I can't seem to get it to work. And example would be great.
ThanksEric
1) DTS package
2) SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:254E3DCB-06A0-4D59-9BAB-120B33A59F0B@.microsoft.com...
> I have a table called cr. Within that table I have the colums c_id,
c_type, first_name, last_name. I need help creating a query that will pull
from an excel file that have the same colum names. This excel file is
automaticaly generated from one of our systems and the c_id will never
change for the record.
> So this is what im wanting to do. I need it to look at the xls file and if
there are new records in that xls file it will add those to the table or if
the records have changed it will update the records within the table based
on the c_id. I think this is feasable but I can't seem to get it to work.
And example would be great.
> Thanks
Wednesday, March 21, 2012
Newbie procedure problem
I have the following table (Student):
Student_id First_name Last_name Sex Title
and I have a procedure problem:
Write a procedure to enter a student's title for a particular record when the procedure is called.
Here is my attempt but it doesn't add anything to the title column:
CREATE OR REPLACE PROCEDURE TITLE(FNAME VARCHAR2, LNAME VARCHAR2, PERTITLE VARCHAR2) AS
BEGIN
UPDATE STUDENT
SET TITLE = PERTITLE
WHERE FIRST_NAME = FNAME AND LAST_NAME = LNAME;
END;
From my understanding of the question, I believe the title gets passed along with the first and second name of the person you want to add the title to. So, if anybody has any suggestions for my problem it would be great.
Jameswell in sql server it would be something like this, oracle or another database might have a slight different syntax.
Your FNAME and LNAME variables where set to varchar(2), not sure but that is a very short last name and first name. They will never get passed correctly if you do not allow enough spaces, these should be set to the length of the field in the tables.
CREATE PROCEDURE p_new_user @.FNAME VARCHAR(20), @.LNAME VARCHAR(25), @.PERTITLE VARCHAR(4) AS
UPDATE STUDENT
SET TITLE = @.PERTITLE
WHERE FIRST_NAME = @.FNAME AND LAST_NAME = @.LNAME
GO|||I forgot to say I am using Oracle 9i.|||I believe I have corrected an error I was making. When I was executing the procedure, I was typing the names in upper case when in the table they are stored with the first letter being uppercase and the rest lower case. Sorry for wasting space on the forum!
Student_id First_name Last_name Sex Title
and I have a procedure problem:
Write a procedure to enter a student's title for a particular record when the procedure is called.
Here is my attempt but it doesn't add anything to the title column:
CREATE OR REPLACE PROCEDURE TITLE(FNAME VARCHAR2, LNAME VARCHAR2, PERTITLE VARCHAR2) AS
BEGIN
UPDATE STUDENT
SET TITLE = PERTITLE
WHERE FIRST_NAME = FNAME AND LAST_NAME = LNAME;
END;
From my understanding of the question, I believe the title gets passed along with the first and second name of the person you want to add the title to. So, if anybody has any suggestions for my problem it would be great.
Jameswell in sql server it would be something like this, oracle or another database might have a slight different syntax.
Your FNAME and LNAME variables where set to varchar(2), not sure but that is a very short last name and first name. They will never get passed correctly if you do not allow enough spaces, these should be set to the length of the field in the tables.
CREATE PROCEDURE p_new_user @.FNAME VARCHAR(20), @.LNAME VARCHAR(25), @.PERTITLE VARCHAR(4) AS
UPDATE STUDENT
SET TITLE = @.PERTITLE
WHERE FIRST_NAME = @.FNAME AND LAST_NAME = @.LNAME
GO|||I forgot to say I am using Oracle 9i.|||I believe I have corrected an error I was making. When I was executing the procedure, I was typing the names in upper case when in the table they are stored with the first letter being uppercase and the rest lower case. Sorry for wasting space on the forum!
Subscribe to:
Posts (Atom)