October 8, 2008 at 5:11 pm
Hi guys
I have a table sitting in a database where I dont have permissions to create or save a table.Its our main database. I can just run queries on it.
Now I need to save the results of the below mentioned query into my personal database called "data".
This main database name is "MainDb" and the table which I am using from this database is called
DF_claim.
Now how do I modify this query so that it saves the results in my database or how do I run a query in my database which is pointing to the main database??
select Year(a.application_date) as app_year,
month(a.application_date) as app_month_num,
datename(mm,a.application_date) as app_month,
from DF_CLAIM as a
and a.application_date between '1 jul 2008' and '30 sep 2008'
Thanks guys
Cheers
October 8, 2008 at 5:38 pm
You can reference the main database by name in your from clause.
FROM MainDb.dbo.DF_Claim
You can do that from your own database. If you want to insert the results into a table, your query would look like:
SELECT ...
INTO MyNewTable
FROM MainDb.dbo.DF_Claim
WHERE ...
October 8, 2008 at 8:51 pm
Thanks for that
Cheers
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply