Hi -- I'm new to SQL and thus also new to SQL Server.
I'm working on a project that has data stored in 4 databases. I want to
create a 5th database for my work. I will need to retrieve data from those
other 4 databases -- usually creating tables in my 5th database. I want to
put together stored procedures to do this. I can extract data and create
tables within one database, but have no idea how to reach out to a different
one.
Eventually, in this project I will need to read the records, in order and
create a running calculation -- not a running sum. I can do this within VB
pretty easily, but I don't know if this can be done is a query. The
calculation is: (field 2, record n) =
(field 1, record n) * (1 - field 2, record n-1) + (field2,record n)
Finally, can anyone suggest a good book that might help me with some of
these types of questions?
I'd appreciate any help on any portion of the above!
Thanks,
ArtArt,
To access the tables in the other databases (assuming the same server) just
qualify the object using DATABASE.OWNER.OBJECT i.e., pubs.dbo.authors.
Books (SQL):
The Guru's Guide to Transact-SQL
by Ken Henderson
http://www.amazon.com/exec/obidos/t...=glance&s=books
Professional SQL Server 2000 Programming
by Robert Vieira
http://www.amazon.com/exec/obidos/t...=glance&s=books
Joe Celko's SQL for Smarties (2005 ed)
by Joe Celko
http://www.amazon.com/exec/obidos/t...=books&n=507846
HTH
Jerry
"Art" <Art@.discussions.microsoft.com> wrote in message
news:D5386C63-4FEA-42A6-8958-A2CF67FCB726@.microsoft.com...
> Hi -- I'm new to SQL and thus also new to SQL Server.
> I'm working on a project that has data stored in 4 databases. I want to
> create a 5th database for my work. I will need to retrieve data from
> those
> other 4 databases -- usually creating tables in my 5th database. I want
> to
> put together stored procedures to do this. I can extract data and create
> tables within one database, but have no idea how to reach out to a
> different
> one.
> Eventually, in this project I will need to read the records, in order and
> create a running calculation -- not a running sum. I can do this within
> VB
> pretty easily, but I don't know if this can be done is a query. The
> calculation is: (field 2, record n) =
> (field 1, record n) * (1 - field 2, record n-1) + (field2,record n)
> Finally, can anyone suggest a good book that might help me with some of
> these types of questions?
> I'd appreciate any help on any portion of the above!
> Thanks,
> Art|||Jerry,
Thanks very much! For both answers.
Art
"Jerry Spivey" wrote:
> Art,
> To access the tables in the other databases (assuming the same server) jus
t
> qualify the object using DATABASE.OWNER.OBJECT i.e., pubs.dbo.authors.
> Books (SQL):
> The Guru's Guide to Transact-SQL
> by Ken Henderson
> http://www.amazon.com/exec/obidos/t...=glance&s=books
> Professional SQL Server 2000 Programming
> by Robert Vieira
> http://www.amazon.com/exec/obidos/t...=glance&s=books
> Joe Celko's SQL for Smarties (2005 ed)
> by Joe Celko
> http://www.amazon.com/exec/obidos/t...=books&n=507846
> HTH
> Jerry
> "Art" <Art@.discussions.microsoft.com> wrote in message
> news:D5386C63-4FEA-42A6-8958-A2CF67FCB726@.microsoft.com...
>
>|||>> I can extract data and create tables within one database, but have no
Use 3-part naming like database.owner.object
Perhaps if you post the DDLs, sample data & expected results, others could
give it a try. ( www.aspfaq.com/5006 ). In some cases, using a client side
programming language might be the option. In other cases, you might have to
use some looping construct like a cursor.
SQL Server Books Online should give you most of the basics on t-SQL.
Anith|||Thanks Anith,
I had been using a programming language, but was wondering if I might be
better off using SQL (assuming it's possible). Thanks again.
Art
"Anith Sen" wrote:
> Use 3-part naming like database.owner.object
>
> Perhaps if you post the DDLs, sample data & expected results, others could
> give it a try. ( www.aspfaq.com/5006 ). In some cases, using a client side
> programming language might be the option. In other cases, you might have t
o
> use some looping construct like a cursor.
>
> SQL Server Books Online should give you most of the basics on t-SQL.
> --
> Anith
>
>|||Art, you are in trouble. Let's get back to the basics of an RDBMS.
Rows are not records; fields are not columns; tables are not files;
your post is nonsense. But it tells us that you have no idea about
RDBMS, so your design is probably screw to hell and breakfast.
You seem to be doing attribute splitting on databases; Otherwise, it
would not make sense to mix them.|||"But it tells us that you have no idea about RDBMS"
Hey --CELKO--, keep your posts focused on the issue at hand, not the person
posting. The forum is here to help each other, not to put down people.
This a constant problem with you. Your input is valuable and appreciated,
but these kind of comments are not (at least by me).
Are there no moderators on this site?
"--CELKO--" wrote:
> Art, you are in trouble. Let's get back to the basics of an RDBMS.
> Rows are not records; fields are not columns; tables are not files;
> your post is nonsense. But it tells us that you have no idea about
> RDBMS, so your design is probably screw to hell and breakfast.
> You seem to be doing attribute splitting on databases; Otherwise, it
> would not make sense to mix them.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment