Wednesday, March 28, 2012
Help with sp_send_cdosysmail
Windows 2000 server SP4
SQL Enterprise SP3a
We were using xp_SMTP_Sendmail from SQLDEV.net, and a few procedures
used CDO to send e-mail.
All was fine for years until this weekend.
We installed the following patches:
MS06-031
Microsoft Security Bulletin MS06-031
Vulnerability in RPC Mutual Authentication Could Allow Spoofing
(917736)
MS06-070
Microsoft Security Bulletin MS06-070
Vulnerability in Workstation Service Could Allow Remote Code Execution
(924270)
MS07-017
Microsoft Security Bulletin MS07-017
Vulnerabilities in GDI Could Allow Remote Code Execution (925902)
MS07-022
Microsoft Security Bulletin MS07-022
Vulnerability in Windows Kernel Could Allow Elevation of Privilege
(931784)
MS07-031
Microsoft Security Bulletin MS07-031 - Critical
Vulnerability in the Windows Schannel Security Package Could Allow
Remote
Code Execution (935840)
As soon as I hit this part of the code to create the mail object
EXEC @.hr = sp_OACreate 'CDO.Message', @.iMsg OUT
print @.hr
EXEC @.hr = sp_OAGetErrorInfo NULL, @.source OUT, @.description OUT
print ' Description: ' + @.description
I get the following error
-2147023782
Description: A dynamic link library (DLL) initialization routine
failed.
All other references to @.iMsg fail as the object does not exist.
Source code for Procedure at:
http://support.microsoft.com/kb/312839
Thanks!
David HayI've been able to drill a little further. the SP_OACreate refrences
stdole70.dll
On to the next...
Monday, March 26, 2012
Help with simple SP (newbie)
I'm trying to get a row from one table and insert the results in other
table. By now I have this:
create proc registerTable
@.email varchar(30)
as
select name,email
from users
where email=@.email
go
insert into employees
exec registerTable 'users'
go
But I need to include the insert in the procedure. How can I do that?
Regards,
Diego F.
What do you mean by that ?
--But I need to include the insert in the procedure. How can I do that?
Do you want to execute this recursive ?
Jens.
"Diego F." wrote:
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>
>
|||No. I mean that I need all done into the SP. Now I select the row and
outside I make the insert. I want to call the SP and have all done.
BTW, I put that in the wrong group, sorry.
Regards,
Diego F.
"Jens Smeyer" <JensSmeyer@.discussions.microsoft.com> escribi en el
mensaje news:19270E44-FE1A-4030-AABE-9BD4ECFF7838@.microsoft.com...[vbcol=seagreen]
> What do you mean by that ?
> --But I need to include the insert in the procedure. How can I do that?
> Do you want to execute this recursive ?
> Jens.
> "Diego F." wrote:
|||I dont quite get your question. Is this what you were expecting?
create proc registerTable
@.email varchar(30)
as
insert into employees
select name,email
from users
where email=@.email
go
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
"Diego F." <diegofrNO@.terra.es> wrote in message
news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>
|||Yes, it was exactly that :-)
Regards,
Diego F.
"Vinod Kumar" <vinodk_sct@.NO_SPAM_hotmail.com> escribi en el mensaje
news:db85pe$rc0$1@.news01.intel.com...
>I dont quite get your question. Is this what you were expecting?
> create proc registerTable
> @.email varchar(30)
> as
> insert into employees
> select name,email
> from users
> where email=@.email
> go
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinf...2000/books.asp
> "Diego F." <diegofrNO@.terra.es> wrote in message
> news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
>
Help with simple SP (newbie)
I'm trying to get a row from one table and insert the results in other
table. By now I have this:
create proc registerTable
@.email varchar(30)
as
select name,email
from users
where email=@.email
go
insert into employees
exec registerTable 'users'
go
But I need to include the insert in the procedure. How can I do that?
--
Regards,
Diego F.What do you mean by that ?
--But I need to include the insert in the procedure. How can I do that?
Do you want to execute this recursive ?
Jens.
"Diego F." wrote:
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>
>|||No. I mean that I need all done into the SP. Now I select the row and
outside I make the insert. I want to call the SP and have all done.
BTW, I put that in the wrong group, sorry.
--
Regards,
Diego F.
"Jens Süßmeyer" <JensSmeyer@.discussions.microsoft.com> escribió en el
mensaje news:19270E44-FE1A-4030-AABE-9BD4ECFF7838@.microsoft.com...
> What do you mean by that ?
> --But I need to include the insert in the procedure. How can I do that?
> Do you want to execute this recursive ?
> Jens.
> "Diego F." wrote:
>> Hi. I'm writing my firsts stored procedures.
>> I'm trying to get a row from one table and insert the results in other
>> table. By now I have this:
>> create proc registerTable
>> @.email varchar(30)
>> as
>> select name,email
>> from users
>> where email=@.email
>> go
>> insert into employees
>> exec registerTable 'users'
>> go
>> But I need to include the insert in the procedure. How can I do that?
>> --
>> Regards,
>> Diego F.
>>
>>|||I dont quite get your question. Is this what you were expecting?
create proc registerTable
@.email varchar(30)
as
insert into employees
select name,email
from users
where email=@.email
go
--
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
"Diego F." <diegofrNO@.terra.es> wrote in message
news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>|||Yes, it was exactly that :-)
--
Regards,
Diego F.
"Vinod Kumar" <vinodk_sct@.NO_SPAM_hotmail.com> escribió en el mensaje
news:db85pe$rc0$1@.news01.intel.com...
>I dont quite get your question. Is this what you were expecting?
> create proc registerTable
> @.email varchar(30)
> as
> insert into employees
> select name,email
> from users
> where email=@.email
> go
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
> "Diego F." <diegofrNO@.terra.es> wrote in message
> news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
>> Hi. I'm writing my firsts stored procedures.
>> I'm trying to get a row from one table and insert the results in other
>> table. By now I have this:
>> create proc registerTable
>> @.email varchar(30)
>> as
>> select name,email
>> from users
>> where email=@.email
>> go
>> insert into employees
>> exec registerTable 'users'
>> go
>> But I need to include the insert in the procedure. How can I do that?
>> --
>> Regards,
>> Diego F.
>>
>>
>
Help with simple SP (newbie)
I'm trying to get a row from one table and insert the results in other
table. By now I have this:
create proc registerTable
@.email varchar(30)
as
select name,email
from users
where email=@.email
go
insert into employees
exec registerTable 'users'
go
But I need to include the insert in the procedure. How can I do that?
Regards,
Diego F.What do you mean by that ?
--But I need to include the insert in the procedure. How can I do that?
Do you want to execute this recursive ?
Jens.
"Diego F." wrote:
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>
>|||No. I mean that I need all done into the SP. Now I select the row and
outside I make the insert. I want to call the SP and have all done.
BTW, I put that in the wrong group, sorry.
Regards,
Diego F.
"Jens Smeyer" <JensSmeyer@.discussions.microsoft.com> escribi en el
mensaje news:19270E44-FE1A-4030-AABE-9BD4ECFF7838@.microsoft.com...[vbcol=seagreen]
> What do you mean by that ?
> --But I need to include the insert in the procedure. How can I do that?
> Do you want to execute this recursive ?
> Jens.
> "Diego F." wrote:
>|||I dont quite get your question. Is this what you were expecting?
create proc registerTable
@.email varchar(30)
as
insert into employees
select name,email
from users
where email=@.email
go
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"Diego F." <diegofrNO@.terra.es> wrote in message
news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
> Hi. I'm writing my firsts stored procedures.
> I'm trying to get a row from one table and insert the results in other
> table. By now I have this:
> create proc registerTable
> @.email varchar(30)
> as
> select name,email
> from users
> where email=@.email
> go
> insert into employees
> exec registerTable 'users'
> go
> But I need to include the insert in the procedure. How can I do that?
> --
> Regards,
> Diego F.
>
>|||Yes, it was exactly that :-)
Regards,
Diego F.
"Vinod Kumar" <vinodk_sct@.NO_SPAM_hotmail.com> escribi en el mensaje
news:db85pe$rc0$1@.news01.intel.com...
>I dont quite get your question. Is this what you were expecting?
> create proc registerTable
> @.email varchar(30)
> as
> insert into employees
> select name,email
> from users
> where email=@.email
> go
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp
> "Diego F." <diegofrNO@.terra.es> wrote in message
> news:uQNgczRiFHA.3216@.TK2MSFTNGP10.phx.gbl...
>sql
Wednesday, March 21, 2012
Help with reuse methology?
use. Creating dynamic (one that takes a string and executes the sql in it)
stored procedures is expensive performance wise. However, they do allow you
to pass in strings of sql and execute it. I find in general that SPs are
created and can only be used for one specific thing - registration form
input, account info update, etc. For example, I can't take the account
update SP and use it for the registration input SP.
Is there some general or fundamental guide that should be followed to lower
the overall number of stored procedures in a database?
Thanks,
BrettBrett wrote:
> I find that many stored procedures are necessary in nearly all
> databases I use. Creating dynamic (one that takes a string and
> executes the sql in it) stored procedures is expensive performance
> wise. However, they do allow you to pass in strings of sql and
> execute it. I find in general that SPs are created and can only be
> used for one specific thing - registration form input, account info
> update, etc. For example, I can't take the account update SP and use
> it for the registration input SP.
> Is there some general or fundamental guide that should be followed to
> lower the overall number of stored procedures in a database?
> Thanks,
> Brett
Not really. You need what you need. Dynamic SQL is not the way to go.
It's really no different than executing the SQL statement directly from
the client and exposes your database to SQL injection and performance
issues.
Writing stored procedures is just a part of the application development
process. You can leverage things like functions or utility-type stored
procs to simplify repetitive code, but not much you can do to lower the
number of procedures you need.
David Gugick
Imceda Software
www.imceda.com
Help with Restore
I inherited a database that was not maintained correctly. I have learned
that the previous DBA had not created any SQL backup procedures, so they've
been running for at least 6 months with no safety net. Of course, some data
has been deleted by users and I need to find a way to restore the data as
they are screaming bloody murder.
I do, however, have backups of the data and log files which are from the
regular server backup. Can I create a new database of the correct name on
another server, and then restore those files to that database? Or is it
expecting the server to have the same name as before?
Any and all suggestions are appreciated.
Thanks,
George
George
You definitely can restore a database to onother server.
If you don't have the same files path look at WITH MOVE option in the BOL.
"George Hutto" <yougott@.bekidding.com> wrote in message
news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so
they've
> been running for at least 6 months with no safety net. Of course, some
data
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>
|||Hi
Just to add, if SQL was shut down at the time of backup, you can use them,
otherwise you don't have anything as the files would have been in use.
Regards
Mike
"George Hutto" wrote:
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so they've
> been running for at least 6 months with no safety net. Of course, some data
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>
>
|||Uri,
I don't have .BAK files, what I have are copies of the .DAT and .LOG files
from a particular date. I don't know if we are both talking about the same
sort of scenario.
George
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23UXz6pZxEHA.1524@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> George
> You definitely can restore a database to onother server.
> If you don't have the same files path look at WITH MOVE option in the BOL.
>
>
> "George Hutto" <yougott@.bekidding.com> wrote in message
> news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
learned[vbcol=seagreen]
> they've
> data
as[vbcol=seagreen]
on
>
|||Really Mike? That will make things darned difficult.
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:C563452E-54A2-46F6-9E13-7DFE3332B7E1@.microsoft.com...[vbcol=seagreen]
> Hi
> Just to add, if SQL was shut down at the time of backup, you can use them,
> otherwise you don't have anything as the files would have been in use.
> Regards
> Mike
> "George Hutto" wrote:
learned[vbcol=seagreen]
they've[vbcol=seagreen]
data[vbcol=seagreen]
as[vbcol=seagreen]
on[vbcol=seagreen]
Help with Restore
I inherited a database that was not maintained correctly. I have learned
that the previous DBA had not created any SQL backup procedures, so they've
been running for at least 6 months with no safety net. Of course, some data
has been deleted by users and I need to find a way to restore the data as
they are screaming bloody murder.
I do, however, have backups of the data and log files which are from the
regular server backup. Can I create a new database of the correct name on
another server, and then restore those files to that database? Or is it
expecting the server to have the same name as before?
Any and all suggestions are appreciated.
Thanks,
GeorgeGeorge
You definitely can restore a database to onother server.
If you don't have the same files path look at WITH MOVE option in the BOL.
"George Hutto" <yougott@.bekidding.com> wrote in message
news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so
they've
> been running for at least 6 months with no safety net. Of course, some
data
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>|||Hi
Just to add, if SQL was shut down at the time of backup, you can use them,
otherwise you don't have anything as the files would have been in use.
Regards
Mike
"George Hutto" wrote:
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so they've
> been running for at least 6 months with no safety net. Of course, some data
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>
>|||Uri,
I don't have .BAK files, what I have are copies of the .DAT and .LOG files
from a particular date. I don't know if we are both talking about the same
sort of scenario.
George
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23UXz6pZxEHA.1524@.TK2MSFTNGP09.phx.gbl...
> George
> You definitely can restore a database to onother server.
> If you don't have the same files path look at WITH MOVE option in the BOL.
>
>
> "George Hutto" <yougott@.bekidding.com> wrote in message
> news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
> > Folks,
> >
> > I inherited a database that was not maintained correctly. I have
learned
> > that the previous DBA had not created any SQL backup procedures, so
> they've
> > been running for at least 6 months with no safety net. Of course, some
> data
> > has been deleted by users and I need to find a way to restore the data
as
> > they are screaming bloody murder.
> >
> > I do, however, have backups of the data and log files which are from the
> > regular server backup. Can I create a new database of the correct name
on
> > another server, and then restore those files to that database? Or is it
> > expecting the server to have the same name as before?
> >
> > Any and all suggestions are appreciated.
> >
> > Thanks,
> >
> > George
> >
> >
>|||Really Mike? That will make things darned difficult.
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:C563452E-54A2-46F6-9E13-7DFE3332B7E1@.microsoft.com...
> Hi
> Just to add, if SQL was shut down at the time of backup, you can use them,
> otherwise you don't have anything as the files would have been in use.
> Regards
> Mike
> "George Hutto" wrote:
> > Folks,
> >
> > I inherited a database that was not maintained correctly. I have
learned
> > that the previous DBA had not created any SQL backup procedures, so
they've
> > been running for at least 6 months with no safety net. Of course, some
data
> > has been deleted by users and I need to find a way to restore the data
as
> > they are screaming bloody murder.
> >
> > I do, however, have backups of the data and log files which are from the
> > regular server backup. Can I create a new database of the correct name
on
> > another server, and then restore those files to that database? Or is it
> > expecting the server to have the same name as before?
> >
> > Any and all suggestions are appreciated.
> >
> > Thanks,
> >
> > George
> >
> >
> >
Help with Restore
I inherited a database that was not maintained correctly. I have learned
that the previous DBA had not created any SQL backup procedures, so they've
been running for at least 6 months with no safety net. Of course, some data
has been deleted by users and I need to find a way to restore the data as
they are screaming bloody murder.
I do, however, have backups of the data and log files which are from the
regular server backup. Can I create a new database of the correct name on
another server, and then restore those files to that database? Or is it
expecting the server to have the same name as before?
Any and all suggestions are appreciated.
Thanks,
GeorgeGeorge
You definitely can restore a database to onother server.
If you don't have the same files path look at WITH MOVE option in the BOL.
"George Hutto" <yougott@.bekidding.com> wrote in message
news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so
they've
> been running for at least 6 months with no safety net. Of course, some
data
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>|||Hi
Just to add, if SQL was shut down at the time of backup, you can use them,
otherwise you don't have anything as the files would have been in use.
Regards
Mike
"George Hutto" wrote:
> Folks,
> I inherited a database that was not maintained correctly. I have learned
> that the previous DBA had not created any SQL backup procedures, so they'v
e
> been running for at least 6 months with no safety net. Of course, some da
ta
> has been deleted by users and I need to find a way to restore the data as
> they are screaming bloody murder.
> I do, however, have backups of the data and log files which are from the
> regular server backup. Can I create a new database of the correct name on
> another server, and then restore those files to that database? Or is it
> expecting the server to have the same name as before?
> Any and all suggestions are appreciated.
> Thanks,
> George
>
>|||Uri,
I don't have .BAK files, what I have are copies of the .DAT and .LOG files
from a particular date. I don't know if we are both talking about the same
sort of scenario.
George
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23UXz6pZxEHA.1524@.TK2MSFTNGP09.phx.gbl...
> George
> You definitely can restore a database to onother server.
> If you don't have the same files path look at WITH MOVE option in the BOL.
>
>
> "George Hutto" <yougott@.bekidding.com> wrote in message
> news:urzyAmZxEHA.908@.TK2MSFTNGP11.phx.gbl...
learned[vbcol=seagreen]
> they've
> data
as[vbcol=seagreen]
on[vbcol=seagreen]
>|||Really Mike? That will make things darned difficult.
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:C563452E-54A2-46F6-9E13-7DFE3332B7E1@.microsoft.com...[vbcol=seagreen]
> Hi
> Just to add, if SQL was shut down at the time of backup, you can use them,
> otherwise you don't have anything as the files would have been in use.
> Regards
> Mike
> "George Hutto" wrote:
>
learned[vbcol=seagreen]
they've[vbcol=seagreen]
data[vbcol=seagreen]
as[vbcol=seagreen]
on[vbcol=seagreen]
Sunday, February 19, 2012
Help with JOINS in Stored Procedures
I am making a stored procedure, and I need to set some variables based on the results of a JOIN statement.
If I something like:
SELECT table.field, table.field2 FROM table INNER JOIN table2 ON table.field = string
How could I get the results and set them in variables?
Any help would be greatly appreciated.
GKC
Are you trying to do something like this?
CREATE PROCEDURE dbo.TestProcedure
(
@.SomeString varchar(50)
)
AS
SET NOCOUNT ON
SELECT t1.Field1, t1.Field2
FROM Table AS t1
INNER JOIN Table2 AS t2 ON t2.Field = t1.Field1
WHERE t1.Field1 = @.SomeString
HTH,
Ryan
SELECT field1, field2, field3
FROM first_table
INNER JOIN second_table
ON first_table.keyfield = second_table.foreign_keyfield
And take the results and put set them in some variables|||
DECLARE @.f1 ...
DECLARE @.f2 ...
DECLARE @.f3 ...
SELECT @.f1=field1, @.f2=field2, @.f3=field3
FROM first_table
INNER JOIN second_table
ON first_table.keyfield = second_table.foreign_keyfield
|||
GENIUS! So simple, I never thought!
Thank you!