April 23, 2014 at 3:01 am
Hi there
I am getting the error "Could not find server 'bmf' in sysservers. Executive sp_addlinkedserver to add the server to sysservers" when running the following script.
The weird thing is, if I remove the last bit of the FROM statement (i.e. bmf.dbo.activities.activity_desc actdesc2) then the script runs fine. I'm confused as the same server and DB are being referenced elsewhere in the FROM part of the script.
Any help would be much appreciated!
Thank you.
SELECT organisations.organisation_number, organisations.name, organisations.status,
activities.activity_desc, activity_values.activity_value_desc, organisation_categories.quantity,
orgcat2.activity, orgcat2.activity_value, actval2.activity_value_desc
FROM bmf.dbo.activity_values activity_values, bmf.dbo.organisation_categories organisation_categories, bmf.dbo.organisations organisations,
bmf.dbo.activities, bmf.dbo.organisation_categories orgcat2, bmf.dbo.activity_values actval2,
bmf.dbo.activities.activity_desc actdesc2
WHERE activity_values.activity = organisation_categories.activity
AND activity_values.activity_value = organisation_categories.activity_value
AND actval2.activity = organisation_categories.activity
AND actval2.activity_value = organisation_categories.activity_value
AND activities.activity = organisation_categories.activity
AND organisation_categories.organisation_number = organisations.organisation_number
AND orgcat2.organisation_number = organisations.organisation_number
/*This is the section that you need to change*/
/*You can use = or IN*/
AND ((organisation_categories.activity='BG2')
AND (organisation_categories.activity_value='Y')
AND (organisations.status IN ('FULL','POT')
AND (orgcat2.activity='COMM')
AND (orgcat2.activity_value='A')))
ORDER BY organisations.name
April 23, 2014 at 4:10 am
can you please tell me what is this
bmf.dbo.activities.activity_desc
is it a table or view or proceduer or function etc, what ever it may be i have some doubt here
bmf.dbo.activities.activity_desc
from this
what is bmf?
what is dbo?
what is activities?
what is activity_desc?
if you answer the above questions clearly, you will able to analyze the problem
/**Edited***/
it seems are you try to use a table name
bmf.dbo.activity_desc
Not sure what you want to do there?
Every rule in a world of bits and bytes, can be bend or eventually be broken
MyBlog About Common dialog control
A Visualizer for viewing SqlCommand object script [/url]
April 23, 2014 at 4:15 am
Hi there
Thanks for your reply.
activities is a tables, and activity_desc is a column on that table.
Best wishes
Jon
April 23, 2014 at 4:17 am
how did you use a column in the from clause it would be like this
SELECT organisations.organisation_number, organisations.name, organisations.status,
activities.activity_desc, activity_values.activity_value_desc, organisation_categories.quantity,
orgcat2.activity, orgcat2.activity_value, actval2.activity_value_desc,
bmf.dbo.activities.activity_desc actdesc2
FROM bmf.dbo.activity_values activity_values, bmf.dbo.organisation_categories organisation_categories, bmf.dbo.organisations organisations,
bmf.dbo.activities, bmf.dbo.organisation_categories orgcat2, bmf.dbo.activity_values actval2
WHERE activity_values.activity = organisation_categories.activity
AND activity_values.activity_value = organisation_categories.activity_value
AND actval2.activity = organisation_categories.activity
AND actval2.activity_value = organisation_categories.activity_value
AND activities.activity = organisation_categories.activity
AND organisation_categories.organisation_number = organisations.organisation_number
AND orgcat2.organisation_number = organisations.organisation_number
/*This is the section that you need to change*/
/*You can use = or IN*/
AND ((organisation_categories.activity='BG2')
AND (organisation_categories.activity_value='Y')
AND (organisations.status IN ('FULL','POT')
AND (orgcat2.activity='COMM')
AND (orgcat2.activity_value='A')))
ORDER BY organisations.name
Every rule in a world of bits and bytes, can be bend or eventually be broken
MyBlog About Common dialog control
A Visualizer for viewing SqlCommand object script [/url]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply