Showing posts with label query. Show all posts
Showing posts with label query. Show all posts

Sunday, March 25, 2012

Cannot reference new attribute in Active Directory

We have had an existing linked server that we used to query AD and everything was working as expected. We had to add a new attribute so the AD schema was extended.

Now when I try to reference the new field I get the following error:

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'ADsDSOObject' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'ADsDSOObject' IColumnsInfo::GetColumnsInfo returned 0x80004005: The provider did not give any information about the error.].

Here is the code that gives the error:

SELECT employeeNumber as Employee_Number,
NECASupervisor
FROM OpenQuery(ADSI,
'SELECT employeeNumber,NECASupervisor
from ''LDAP://OU=NECA,OU=UserAccounts,DC=neca,DC=pri''
')

This query works fine:

SELECT employeeNumber as Employee_Number
FROM OpenQuery(ADSI,
'SELECT employeeNumber
from ''LDAP://OU=NECA,OU=UserAccounts,DC=neca,DC=pri''
')

Note: The field NECASupervisor is the new AD attribute. It is in the UserAccounts OU. If I run the same type of query using VB script it finds the attribute.

Anyone have any ideas on this?


Thanks


It turns out that once the Sql Server was rebooted, the query was able to reference the new AD attributes.

Cannot reference new attribute in Active Directory

We have had an existing linked server that we used to query AD and everything was working as expected. We had to add a new attribute so the AD schema was extended.

Now when I try to reference the new field I get the following error:

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'ADsDSOObject' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'ADsDSOObject' IColumnsInfo::GetColumnsInfo returned 0x80004005: The provider did not give any information about the error.].

Here is the code that gives the error:

SELECT employeeNumber as Employee_Number,
NECASupervisor
FROM OpenQuery(ADSI,
'SELECT employeeNumber,NECASupervisor
from ''LDAP://OU=NECA,OU=UserAccounts,DC=neca,DC=pri''
')

This query works fine:

SELECT employeeNumber as Employee_Number
FROM OpenQuery(ADSI,
'SELECT employeeNumber
from ''LDAP://OU=NECA,OU=UserAccounts,DC=neca,DC=pri''
')

Note: The field NECASupervisor is the new AD attribute. It is in the UserAccounts OU. If I run the same type of query using VB script it finds the attribute.

Anyone have any ideas on this?


Thanks


It turns out that once the Sql Server was rebooted, the query was able to reference the new AD attributes.

Cannot read the next data row for the data set

Hi,

My report runs fine when I view in VS, data shows fine when I run the query in the data window, but when I publish it to the server, I get the above error. I am running SQL server 2005 RTM and I have re-deployed the entire solution.

Any ideas?

Found the problem.

This is a problem that is down to a bug in reporting services, and I sincerely hope that "they" fix it in the first sp!

Occasionally, reporting services will change your parameter types to string. This is sooooo annoying, and normally fails when you view, but in this case, it took my parameters (date/time) that were already in the parameter boxes (I am altering an existing report) and ran the report happily. I just happened to see that there were no calendar boxes next to the parameters on my web server.

^%$£"$%^&*&%£$%^&(*&^%$ is all I can say - this has wasted 2 hours of my time.

Please please Microsoft, fix this bug! A hot fix would be good.....beg beg

|||

Hi,

I experienced similar problems with some of my RS reports and find a solution for my case

I tried to explain the problem and solution at the article http://www.kodyaz.com/articles/article.aspx?articleid=53

For my situation, it seemed that the NULL values within aggregate functions were causing the problem.

Actually although the sql code runs successsfully the warning message "Warning: Null value is eliminated by an aggregate or other SET operation." returned from the sql server was causing the Reporting Services to fire the below error:

An error occured during report processing.
Cannot read the next data row for the data set Dataset1.
A sever error occured on the current command. The results, if any, should be discarded.

A simple way to get rid of the problem is running the t-sql codes between "SET ANSI_WARNINGS OFF" and "SET ANSI_WARNINGS ON" commands.

Eralper

http://www.kodyaz.com

|||Rather than beg microsoft to fix their own mistakes wouldn't you rather use a system that if it had a mistake you could: contact the programmers or fix the mistake yourself?

Using open source ruby (in any OS) you can contact the community or alter the code yourself. Ruby can do anything this reporting services can do.

I've found quite a few bugs in Reporting Services, but rather than beg MS to listen to me I've stopped using MS. I post the bugs to a hacker site, this is much more likely to get MS's attention.

Cannot read the next data row for the data set

Hi,

My report runs fine when I view in VS, data shows fine when I run the query in the data window, but when I publish it to the server, I get the above error. I am running SQL server 2005 RTM and I have re-deployed the entire solution.

Any ideas?

Found the problem.

This is a problem that is down to a bug in reporting services, and I sincerely hope that "they" fix it in the first sp!

Occasionally, reporting services will change your parameter types to string. This is sooooo annoying, and normally fails when you view, but in this case, it took my parameters (date/time) that were already in the parameter boxes (I am altering an existing report) and ran the report happily. I just happened to see that there were no calendar boxes next to the parameters on my web server.

^%$£"$%^&*&%£$%^&(*&^%$ is all I can say - this has wasted 2 hours of my time.

Please please Microsoft, fix this bug! A hot fix would be good.....beg beg

|||

Hi,

I experienced similar problems with some of my RS reports and find a solution for my case

I tried to explain the problem and solution at the article http://www.kodyaz.com/articles/article.aspx?articleid=53

For my situation, it seemed that the NULL values within aggregate functions were causing the problem.

Actually although the sql code runs successsfully the warning message "Warning: Null value is eliminated by an aggregate or other SET operation." returned from the sql server was causing the Reporting Services to fire the below error:

An error occured during report processing.
Cannot read the next data row for the data set Dataset1.
A sever error occured on the current command. The results, if any, should be discarded.

A simple way to get rid of the problem is running the t-sql codes between "SET ANSI_WARNINGS OFF" and "SET ANSI_WARNINGS ON" commands.

Eralper

http://www.kodyaz.com

|||Rather than beg microsoft to fix their own mistakes wouldn't you rather use a system that if it had a mistake you could: contact the programmers or fix the mistake yourself?

Using open source ruby (in any OS) you can contact the community or alter the code yourself. Ruby can do anything this reporting services can do.

I've found quite a few bugs in Reporting Services, but rather than beg MS to listen to me I've stopped using MS. I post the bugs to a hacker site, this is much more likely to get MS's attention.

Cannot read the next data row for the data set

Hi,

My report runs fine when I view in VS, data shows fine when I run the query in the data window, but when I publish it to the server, I get the above error. I am running SQL server 2005 RTM and I have re-deployed the entire solution.

Any ideas?

Found the problem.

This is a problem that is down to a bug in reporting services, and I sincerely hope that "they" fix it in the first sp!

Occasionally, reporting services will change your parameter types to string. This is sooooo annoying, and normally fails when you view, but in this case, it took my parameters (date/time) that were already in the parameter boxes (I am altering an existing report) and ran the report happily. I just happened to see that there were no calendar boxes next to the parameters on my web server.

^%$£"$%^&*&%£$%^&(*&^%$ is all I can say - this has wasted 2 hours of my time.

Please please Microsoft, fix this bug! A hot fix would be good.....beg beg

|||

Hi,

I experienced similar problems with some of my RS reports and find a solution for my case

I tried to explain the problem and solution at the article http://www.kodyaz.com/articles/article.aspx?articleid=53

For my situation, it seemed that the NULL values within aggregate functions were causing the problem.

Actually although the sql code runs successsfully the warning message "Warning: Null value is eliminated by an aggregate or other SET operation." returned from the sql server was causing the Reporting Services to fire the below error:

An error occured during report processing.
Cannot read the next data row for the data set Dataset1.
A sever error occured on the current command. The results, if any, should be discarded.

A simple way to get rid of the problem is running the t-sql codes between "SET ANSI_WARNINGS OFF" and "SET ANSI_WARNINGS ON" commands.

Eralper

http://www.kodyaz.com

|||Rather than beg microsoft to fix their own mistakes wouldn't you rather use a system that if it had a mistake you could: contact the programmers or fix the mistake yourself?

Using open source ruby (in any OS) you can contact the community or alter the code yourself. Ruby can do anything this reporting services can do.

I've found quite a few bugs in Reporting Services, but rather than beg MS to listen to me I've stopped using MS. I post the bugs to a hacker site, this is much more likely to get MS's attention.sql

Cannot Query Excel Linked Server

Hello,

I have attempted to set up a linked server to an Excel 2003 workbook, and I get an OLEDB error when I attempt to query against it. Some notes about the workbook;

-It has one worksheet in it named 'Add Revenue Accts'.
-The name of the workbook is 'Revenue_to_All_Accounts.xls'
-Its location is \\cdnbwfin1\data\CDunn\Comdata\Reports\Reba_Holmes\Revenue_All_Accounts

I have the linked server configured as follows;

-Linked Server; REVENUE_TO_ALL_ACCOUNTS
-Provider; Microsoft Jet 4.0 OLE DB Provider
-Data Source; \\cdnbwfin1\data\CDunn\Comdata\Reports\Reba_Holmes\Revenue_All_Accounts\Revenue_to_All_Accounts.xls
-Provider String; Microsoft.Jet.OLEDB.4.0;Data Source=\\Cdnbwfin1\Data\CDunn\Comdata\Reports\Reba_Holmes\Revenue_All_Accounts\Revenue_to_All_Accounts.xls;Persist Security Info=False

When I attempt the following query;
SELECT * FROM OPENQUERY(REVENUE_TO_ALL_ACCOUNTS, 'SELECT * FROM [Add Revenue Accts$]')

The following message appears, and no results are returned;

[OLE/DB provider returned message: Unspecified error]
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: ].
Msg 7399, Level 16, State 1, Procedure sp_tables_ex, Line 20
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.

I have Googled this error, but I have not found anything that really points to what the problem might be. What could be the problem?

Thank you for your help!

cdun2

Hi,

how are you connecting to the SQL Server while using this query ? If you are connecting to the server using a SQL Server login, the process will try to impersonate the SQL Server account (that one that runs the service of SQL Server) to acces the network file. If the Service account is not priviledged to access the file nor the network share, the process will fail. Could you describe your used enviuronment for a better understanding if the above description is your problem ?

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

cannot query directory services

Dear all,
I would like to query informations that are located in the (AD) Active
Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
the same domain and AD.
I create the link server with the following script :
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
GO
and I query AD with the following :
SELECT [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
'SELECT Name, SN, ST
FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
WHERE objectCategory = ''Person'' AND
objectClass = ''contact''')
GO
Then I get the following error :
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prep
are
returned 0x80040e14].
I clarify that I used Integrated Windows security and also used the USERID
and password of service SQLserver as recommanded to launch my query.
But I get the above error. Why ?
Thanks for your next reply,
JobHi
You may get a better response in the ADSI news groups e.g
microsoft.public.adsi.general, but I think the error is probably because the
syntax of your query is incorrect, check out
http://msdn.microsoft.com/library/d...ap_provider.asp
John
"Job" wrote:

> Dear all,
> I would like to query informations that are located in the (AD) Active
> Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4
in
> the same domain and AD.
> I create the link server with the following script :
> EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
> 'ADSDSOObject', 'adsdatasource'
> GO
> and I query AD with the following :
> SELECT [Name], SN [Last Name], ST State
> FROM OPENQUERY( ADSI,
> 'SELECT Name, SN, ST
> FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
> WHERE objectCategory = ''Person'' AND
> objectClass = ''contact''')
> GO
> Then I get the following error :
> Server: Msg 7321, Level 16, State 2, Line 1
> An error occurred while preparing a query for execution against OLE DB
> provider 'ADSDSOObject'.
> OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Pr
epare
> returned 0x80040e14].
> I clarify that I used Integrated Windows security and also used the USERID
> and password of service SQLserver as recommanded to launch my query.
> But I get the above error. Why ?
> Thanks for your next reply,
> Job
>
>

cannot query directory services

Dear all,
I would like to query informations that are located in the (AD) Active
Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
the same domain and AD.
I create the link server with the following script :
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
GO
and I query AD with the following :
SELECT [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
'SELECT Name, SN, ST
FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
WHERE objectCategory = ''Person'' AND
objectClass = ''contact''')
GO
Then I get the following error :
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
returned 0x80040e14].
I clarify that I used Integrated Windows security and also used the USERID
and password of service SQLserver as recommanded to launch my query.
But I get the above error. Why ?
Thanks for your next reply,
JobHi
You may get a better response in the ADSI news groups e.g
microsoft.public.adsi.general, but I think the error is probably because the
syntax of your query is incorrect, check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/adsi_ldap_provider.asp
John
"Job" wrote:
> Dear all,
> I would like to query informations that are located in the (AD) Active
> Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
> the same domain and AD.
> I create the link server with the following script :
> EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
> 'ADSDSOObject', 'adsdatasource'
> GO
> and I query AD with the following :
> SELECT [Name], SN [Last Name], ST State
> FROM OPENQUERY( ADSI,
> 'SELECT Name, SN, ST
> FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
> WHERE objectCategory = ''Person'' AND
> objectClass = ''contact''')
> GO
> Then I get the following error :
> Server: Msg 7321, Level 16, State 2, Line 1
> An error occurred while preparing a query for execution against OLE DB
> provider 'ADSDSOObject'.
> OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
> returned 0x80040e14].
> I clarify that I used Integrated Windows security and also used the USERID
> and password of service SQLserver as recommanded to launch my query.
> But I get the above error. Why ?
> Thanks for your next reply,
> Job
>
>sql

cannot query directory services

Dear all,
I would like to query informations that are located in the (AD) Active
Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
the same domain and AD.
I create the link server with the following script :
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
'ADSDSOObject', 'adsdatasource'
GO
and I query AD with the following :
SELECT [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
'SELECT Name, SN, ST
FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
WHERE objectCategory = ''Person'' AND
objectClass = ''contact''')
GO
Then I get the following error :
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB
provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
returned 0x80040e14].
I clarify that I used Integrated Windows security and also used the USERID
and password of service SQLserver as recommanded to launch my query.
But I get the above error. Why ?
Thanks for your next reply,
Job
Hi
You may get a better response in the ADSI news groups e.g
microsoft.public.adsi.general, but I think the error is probably because the
syntax of your query is incorrect, check out
http://msdn.microsoft.com/library/de...p_provider.asp
John
"Job" wrote:

> Dear all,
> I would like to query informations that are located in the (AD) Active
> Directory Windows 2003 with my server Windows 2000SP4 and MS SQL 2000 SP4 in
> the same domain and AD.
> I create the link server with the following script :
> EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',
> 'ADSDSOObject', 'adsdatasource'
> GO
> and I query AD with the following :
> SELECT [Name], SN [Last Name], ST State
> FROM OPENQUERY( ADSI,
> 'SELECT Name, SN, ST
> FROM ''LDAP://ADSISrv/ OU=myOU,DC=mycompagny,DC=com''
> WHERE objectCategory = ''Person'' AND
> objectClass = ''contact''')
> GO
> Then I get the following error :
> Server: Msg 7321, Level 16, State 2, Line 1
> An error occurred while preparing a query for execution against OLE DB
> provider 'ADSDSOObject'.
> OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare
> returned 0x80040e14].
> I clarify that I used Integrated Windows security and also used the USERID
> and password of service SQLserver as recommanded to launch my query.
> But I get the above error. Why ?
> Thanks for your next reply,
> Job
>
>

Thursday, March 22, 2012

Cannot operate on a set with more than 4,294,967,296 tuples.

Below is an error that I run into often. Can someone tell me what is causing this and how to resolve it?

Executing the query ...

The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.

Execution complete

Here is the MDX that caused the error:

With

Member [Measures].[Total Count] as

'[Measures].[Crash Count]'

Member [Measures].[Total Fatal] as

'[Measures].[Fatal Crashes]'

Member [Measures].[Total Injury] as

'[Measures].[Injury Crashes]'

Member [Measures].[Total A Injury] as

'[Measures].[A Injury Crashes]'

Member [Measures].[Total B Injury] as

'[Measures].[B Injury Crashes]'

Member [Measures].[Total C Injury] as

'[Measures].[C Injury Crashes]'

Member [Measures].[Total 0 Property Damage] as

'[Measures].[0 Property Damage Crashes]'

SELECT

NON EMPTY { [Measures].[Total Count],

[Measures].[Total Fatal],

[Measures].[Total Injury],

[Measures].[Total A Injury],

[Measures].[Total B Injury],

[Measures].[Total C Injury],

[Measures].[Total 0 Property Damage],

[Measures].[Vehicle Count],

[Measures].[Person Count],

[Measures].[Fatalities],

[Measures].[0 Injuries],

[Measures].[A Injuries],

[Measures].[B Injuries],

[Measures].[C Injuries],

[Measures].[Injuries] }

ON COLUMNS,

NON EMPTY {[Crash].[Case Nbr].[Case Nbr] *

[Date].[Calendar Date].[Date] *

[Crash].[Weather].[Weather] *

[Crash].[Road Defects].[Road Defects] *

[Crash].[Collision Type].[Collision Type] *

[Crash].[Light].[Light] }

DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM

(select strtoset('{[Crash].[County].&[Morgan] }')

on columns From

(SELECT STRTOMEMBER('[Crash].[TS Crash Mile Station].[5.28]') :

STRTOMEMBER('[Crash].[TS Crash Mile Station].[5.77]')

on columns From

(select {descendants([Crash].[Case Nbr].Currentmember)}

on Columns from

[SDM_Reports] ))) where ([Reportability].[Is Reportable].&[

Quick Update on this issue,

If I remove the [Crash].[Case Nbr].[Case Nbr] from Rows, then the error goes away.

|||

I am having the same problem..Can somebody help....

I want to know what causes this problem..

|||http://www.sqljunkies.com/WebLog/mosha/archive/2007/1/28.aspxsql

cannot open table in Enterprise manager

Hi, each time I want to open a table (return all rows)
this message pop up:
The query cannot be executed because some files are
either missing or not registered.
I found, on microsoft.com, that I just have to reinstall
the product or use regsvr32.exe to register some dll's.
I tried both solutions and it's not working.
Any ideas?
thanks
A little more information might help - What application are you using to
perform the query?
Jim
"eric champagne" <anonymous@.discussions.microsoft.com> wrote in message
news:1417e01c41801$7a6a3070$a601280a@.phx.gbl...
> Hi, each time I want to open a table (return all rows)
> this message pop up:
> The query cannot be executed because some files are
> either missing or not registered.
> I found, on microsoft.com, that I just have to reinstall
> the product or use regsvr32.exe to register some dll's.
> I tried both solutions and it's not working.
> Any ideas?
> thanks
|||sql server enterprise manager 2000... on my other windows
xp workstation , it's working fine.

>--Original Message--
>A little more information might help - What application
are you using to
>perform the query?
>Jim
>"eric champagne" <anonymous@.discussions.microsoft.com>
wrote in message
>news:1417e01c41801$7a6a3070$a601280a@.phx.gbl...
reinstall
>
>.
>
|||Did you apply Service Pack 3a of SQL Server to the workstation? This needs
to be done to update EM also.
Jim
<anonymous@.discussions.microsoft.com> wrote in message
news:142be01c41813$7d1bddc0$a601280a@.phx.gbl...
> sql server enterprise manager 2000... on my other windows
> xp workstation , it's working fine.
> are you using to
> wrote in message
> reinstall
|||Yes I did that...
It's very strange because it's working on all my other
workstation with XP

>--Original Message--
>Did you apply Service Pack 3a of SQL Server to the
workstation? This needs
>to be done to update EM also.
>Jim
><anonymous@.discussions.microsoft.com> wrote in message
>news:142be01c41813$7d1bddc0$a601280a@.phx.gbl...
windows
application
rows)
dll's.
>
>.
>
|||Did you reinstall the client tools?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"eric champagne" <anonymous@.discussions.microsoft.com> wrote in message
news:1417e01c41801$7a6a3070$a601280a@.phx.gbl...
> Hi, each time I want to open a table (return all rows)
> this message pop up:
> The query cannot be executed because some files are
> either missing or not registered.
> I found, on microsoft.com, that I just have to reinstall
> the product or use regsvr32.exe to register some dll's.
> I tried both solutions and it's not working.
> Any ideas?
> thanks
|||Are you trying to use Query Analyzer or the table data browser in EM?
Can you run queries using QA?
Jim
<anonymous@.discussions.microsoft.com> wrote in message
news:143b801c41821$c469c530$a601280a@.phx.gbl...
> Yes I did that...
> It's very strange because it's working on all my other
> workstation with XP
> workstation? This needs
> windows
> application
> rows)
> dll's.

Tuesday, March 20, 2012

cannot open query analyzer and profiler through EM

Hello Experts,
My problem is that I can't call QA and Profiler through Enterprise Manager
from the tools menu.
I made some MSDE installations and UnInstallations for debug reasons and
then this problem occurred.
Step 1) Installing an named instance "MYINSTANCE"
Step 2) UnInstalling "MYINSTANCE"
Step 3) ReInstalling "MYINSTANCE"
Step 4) UnInstalling "MYINSTANCE"
Can anyone please help me with this? I'm afraid that may be other functions
have crashed, but this is the first problem face up.
Regards!What happens when you go to Start|Run, type "isqlw" without the quotes, and
hit enter?
Or if you run Query Analyzer or Profiler from the Start Menu?
FWIW, I always call those tools directly.
"x-rays" <xrays@.discussions.microsoft.com> wrote in message
news:9F764D97-FE3F-4E80-90AE-7A7DD34DB2CB@.microsoft.com...
> Hello Experts,
> My problem is that I can't call QA and Profiler through Enterprise Manager
> from the tools menu.
> I made some MSDE installations and UnInstallations for debug reasons and
> then this problem occurred.
> Step 1) Installing an named instance "MYINSTANCE"
> Step 2) UnInstalling "MYINSTANCE"
> Step 3) ReInstalling "MYINSTANCE"
> Step 4) UnInstalling "MYINSTANCE"
> Can anyone please help me with this? I'm afraid that may be other
> functions
> have crashed, but this is the first problem face up.
> Regards!|||Hello Aaron, thank you for your reply,
No problem with that, qa and profiler work, I think that EM has lost the
right paths for the tools but I don't know where I have to go to correct the
m.
Do you have any Idea?
Regards!
Ο χρ?στη? "Aaron Bertrand [SQL Server MVP]" _γγραψε:

> What happens when you go to Start|Run, type "isqlw" without the quotes, an
d
> hit enter?
> Or if you run Query Analyzer or Profiler from the Start Menu?
> FWIW, I always call those tools directly.
>
>
> "x-rays" <xrays@.discussions.microsoft.com> wrote in message
> news:9F764D97-FE3F-4E80-90AE-7A7DD34DB2CB@.microsoft.com...
>
>|||Hello Aaron and thank you for your reply.
No problem with that, I think that EM have lost the paths of the tools and I
don't know where to go to correct them.
regards!
Ο χρ?στη? "Aaron Bertrand [SQL Server MVP]" _γγραψε:

> What happens when you go to Start|Run, type "isqlw" without the quotes, an
d
> hit enter?
> Or if you run Query Analyzer or Profiler from the Start Menu?
> FWIW, I always call those tools directly.
>
>
> "x-rays" <xrays@.discussions.microsoft.com> wrote in message
> news:9F764D97-FE3F-4E80-90AE-7A7DD34DB2CB@.microsoft.com...
>
>|||> No problem with that, qa and profiler work, I think that EM has lost the
> right paths for the tools but I don't know where I have to go to correct
> them.
> Do you have any Idea?
Reinstall client tools, or stop using EM to launch tools other than EM...|||Ok, thank you very much for your time Aaron.
Ο χρ?στη? "Aaron Bertrand [SQL Server MVP]" _γγραψε:

> Reinstall client tools, or stop using EM to launch tools other than EM...
>
>

Cannot Open Query analyser from SQL Enterprise Manager

I intalled SQL200SP4 on my Windows 2003 server and now, I cannot open Query
analyser from SQL Enterprise Manager.
I get the following message: "The specified file was not found"
I can go to Query Analyser directly from the Start Menu and it works fine.
Can you please suggest, what I should do to fix this?
Thanks
Hello!
I thought this was a managed Newsgroup.
Anyone from Microsoft with a clue, why this is happening and how can I fix
this?
Thanks
"gurusinghj" wrote:

> I intalled SQL200SP4 on my Windows 2003 server and now, I cannot open Query
> analyser from SQL Enterprise Manager.
> I get the following message: "The specified file was not found"
> I can go to Query Analyser directly from the Start Menu and it works fine.
> Can you please suggest, what I should do to fix this?
> Thanks
|||gurusinghj wrote:
> I intalled SQL200SP4 on my Windows 2003 server and now, I cannot open
> Query analyser from SQL Enterprise Manager.
> I get the following message: "The specified file was not found"
> I can go to Query Analyser directly from the Start Menu and it works
> fine.
> Can you please suggest, what I should do to fix this?
> Thanks
Make sure the SQL tools are in your path. The default might look
something like the following in the path environment variable:
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;"
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||Thanks David,
But i do have this in path, but I still get this issue.
Thinking back, I did once install SQL Server 2000 Desktop Engine (MSDE)
after SQl server was already installed. (Another application that I
installed, did the insalltion, without me knowing.)
I did subsequently uninstall it. Do you think, that might have messed up
some registry settings.
Any help on how to restore these back, will be really appreciated.
Thanks
"David Gugick" wrote:

> gurusinghj wrote:
> Make sure the SQL tools are in your path. The default might look
> something like the following in the path environment variable:
> "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;"
>
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>
|||gurusinghj wrote:
> Thanks David,
> But i do have this in path, but I still get this issue.
> Thinking back, I did once install SQL Server 2000 Desktop Engine
> (MSDE) after SQl server was already installed. (Another application
> that I installed, did the insalltion, without me knowing.)
> I did subsequently uninstall it. Do you think, that might have messed
> up some registry settings.
> Any help on how to restore these back, will be really appreciated.
I doubt it. MSDE does not have any client tools and I doubt it would
add/change the PATH variable. If you open a command window and type
ISQL.EXE from the C:\ root folder, does QA come up? Also make sure the
"Start In" folder is the same as the "Target" folder in the shortcut for
SQL EM. The Target should look something like:
C:\WINDOWS\system32\mmc.exe /s "C:\Program Files\Microsoft SQL
Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC"
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||I get the same problem right after installing MSDE also
"David Gugick" wrote:

> gurusinghj wrote:
> I doubt it. MSDE does not have any client tools and I doubt it would
> add/change the PATH variable. If you open a command window and type
> ISQL.EXE from the C:\ root folder, does QA come up? Also make sure the
> "Start In" folder is the same as the "Target" folder in the shortcut for
> SQL EM. The Target should look something like:
> C:\WINDOWS\system32\mmc.exe /s "C:\Program Files\Microsoft SQL
> Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC"
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>
|||In SQL Enterprise Manager (SEM), go to Tools->External Tools; add the path
to isqlw with the parameters
-S[SRV] -d[DBN]
A new menu item should be created under Tools that will launch QA with the
right database and server context based on SEM.
If the "file not found" messge box appears, you might need the full path for
isqlw.exe OR ensure the "isqlw.exe" string appears in the "command field".
If the path contains spaces, you need to wrap the path with double quotes.
The -S and -d parameters are optional but allow you to bypass the connection
dialog each and every launch.
Regards,
Keith
This posting is provided "as is" without inferring rights or warranties.
"jdehne" <jdehne@.discussions.microsoft.com> wrote in message
news:66BE5CD0-0CE9-46E3-A258-A033FD06E75A@.microsoft.com...[vbcol=seagreen]
>I get the same problem right after installing MSDE also
> "David Gugick" wrote:

Monday, March 19, 2012

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO"

I see others having this problem when trying to run a query across a link from 2005 to a 2000 server. But we are already running SP4 on our 2000 server. What gives?

OLE DB provider "SQLNCLI" for linked server "s-1" returned message "Unspecified error".

OLE DB provider "SQLNCLI" for linked server "s-1" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".

Msg 7311, Level 16, State 2, Line 5

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.

Is your server 64-bit? There was a discussion of that case http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=62887&SiteID=1|||64 bit. And I have tested the link against several sql server 2000 instances which report they are all SP4 buy yield the same error messages.

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO"

I see others having this problem when trying to run a query across a link from 2005 to a 2000 server. But we are already running SP4 on our 2000 server. What gives?

OLE DB provider "SQLNCLI" for linked server "s-1" returned message "Unspecified error".

OLE DB provider "SQLNCLI" for linked server "s-1" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".

Msg 7311, Level 16, State 2, Line 5

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.

Is your server 64-bit? There was a discussion of that case http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=62887&SiteID=1|||64 bit. And I have tested the link against several sql server 2000 instances which report they are all SP4 buy yield the same error messages.

Thursday, February 16, 2012

Cannot get serverproperty

Using SQL2k. When I run the command below in query analyzer I get 3 columns
of info. However, when I run the same SELECT from code I get nothing. Can
anyone help? Thanks.
SELECT SERVERPROPERTY('productversion') As SQLVersion,
SERVERPROPERTY('productlevel') As ProdLevel, SERVERPROPERTY('edition') As
SQLEdition
p.s. I want to display this on a VB form. All other commands using my
connection run fine.
DavidDavid Chase (dlchase@.lifetimeinc.com) writes:
> Using SQL2k. When I run the command below in query analyzer I get 3
> columns of info. However, when I run the same SELECT from code I get
> nothing. Can anyone help? Thanks.
> SELECT SERVERPROPERTY('productversion') As SQLVersion,
> SERVERPROPERTY('productlevel') As ProdLevel, SERVERPROPERTY('edition') As
> SQLEdition
> p.s. I want to display this on a VB form. All other commands using my
> connection run fine.
It would certainly help if you posted your VB code, as it's likely
that's where the problem is.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Here is the code.
Set cn = New ADODB.Connection
cn.Open gstrSQLConString
Set rs1 = New ADODB.Recordset
Set rs1 = cn.Execute(strSQL)
strSQL = "SELECT SERVERPROPERTY('productversion') As SQLVersion," & _
" SERVERPROPERTY('productlevel') As ProdLevel," & _
" SERVERPROPERTY('edition') As SQLEdition"
Set rs1 = cn.Execute(strSQL)
If Not rs1.EOF Then
Me.txtCoAddress = CStr(rs1("SQLVersion"))
End If
David
p.s. Just above this code is an identical recordset retrieval that works
perfect.
"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns97AA6601BD26Yazorman@.127.0.0.1...
> David Chase (dlchase@.lifetimeinc.com) writes:
> It would certainly help if you posted your VB code, as it's likely
> that's where the problem is.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||David Chase (dlchase@.lifetimeinc.com) writes:
> Here is the code.
> Set cn = New ADODB.Connection
> cn.Open gstrSQLConString
> Set rs1 = New ADODB.Recordset
> Set rs1 = cn.Execute(strSQL)
> strSQL = "SELECT SERVERPROPERTY('productversion') As SQLVersion," & _
> " SERVERPROPERTY('productlevel') As ProdLevel," & _
> " SERVERPROPERTY('edition') As SQLEdition"
> Set rs1 = cn.Execute(strSQL)
> If Not rs1.EOF Then
> Me.txtCoAddress = CStr(rs1("SQLVersion"))
> End If
> David
> p.s. Just above this code is an identical recordset retrieval that works
> perfect.
Apparently, there is more to it. I tried your code in the attached
VB form, and it seemed to work fine.
Which version of ADO do you use?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Cannot get my TREE VIEW Recursive query to work

My Table Structure

Category_ID Number
Parent_ID Number <--Category_ID reports to this colum
Category_Name Varchar...

MY QUERY <--I replaced the query above with my data
=============================
WITH Hierarchy(Category_ID, Category_Name, Parent_ID, HLevel)
AS
(
SELECT Category_ID, Category_Name, Parent_ID, 0 as HLevel FROM Dir_Categories
UNION ALL
SELECT SubCategory.Category_ID
, SubCategory.Category_Name,
SubCategory.Parent_ID,
HLevel + 1
FROM Dir_Categories SubCategory
INNER JOIN Hierarchy ParentCategory
ON SubCategory.Parent_ID = ParentCategory.Category_ID )
SELECT Category_ID,
Category_Name = Replicate('__', HLevel) + Category_Name,
Parent_ID,
HLevel
FROM Hierarchy

My OUTPUT============

All the categories under reporting to Parent_ID 0 or continuous, then the ones reporting to 1 and so fourth. Subcategories are not showing within their main categories. I AM GOING NUTS WITH THIS.

Can you help me please?One golden rule in database systems is: Never expect the rows to appear in a specific order. If you for some reason need the columns to be in a specific order, use order by on a suitable column. Here you don't have one, sou you'll have to add a column that you can use for sorting, for instance a varchar column containing the list of IDs from root to the node.|||One golden rule in database systems is: Never expect the rows to appear in a specific order. If you for some reason need the columns to be in a specific order, use order by on a suitable column. Here you don't have one, sou you'll have to add a column that you can use for sorting, for instance a varchar column containing the list of IDs from root to the node.

Hmm, I actually have one that lists the category IDs from root to node. That is a good Ideal, I will try that and get back to you.

Thanks|||One golden rule in database systems is: Never expect the rows to appear in a specific order. If you for some reason need the columns to be in a specific order, use order by on a suitable column. Here you don't have one, sou you'll have to add a column that you can use for sorting, for instance a varchar column containing the list of IDs from root to the node.

Look at this output, look at the PathID, can you suggest how I can order that to get the subcategories inside the Categories? I am more of a web guy, and can generally do some good querying but I am better in Oracle.

Check it out:
============================
PATHID
1
10
100,3
101,3
102,3
103,3
104,3
105,3
106,3
107,3
108,3
109,3
11
110,4
111,4
112,4
113,4
114,4
115,4
116,4
117,4
118,4
119,4
12
120,4
121,4
122,4
123,4
124,4
125,4
126,4
127,4
128,4
129,4
13
130,4
131,4
132,4
133,5
134,5
135,5
136,5
137,5
138,5
139,5
14
140,5
141,5
142,5
143,5
144,5
145,5
146,5
147,5
148,5
149,5
15
150,6
151,6
152,6
153,6
154,6
155,6
156,6
157,6
158,6
159,6
16,1
160,6
161,6
162,7
163,7
164,7
165,7
166,7
167,7
168,7
169,8
17,1
170,8
171,8
172,8
173,8
174,8
175,8
176,8
177,8
178,8
179,8
18,1
180,8
181,8
182,8
183,8
184,8
185,8
186,8
187,8
189,8
19,1
190,8
191,8
192,8
193,9
194,9
195,9
196,9
197,9
198,9
199,9
2
20,1
200,9
201,9
202,9
203,9
204,10
205,10
206,10
207,10
208,10
209,10
21,1
210,10
211,10
212,10
213,10
214,10
215,10
216,11
217,11
218,11
219,11
22,1
220,11
221,11
222,11
223,11
224,11
225,11
226,11
227,11
228,11
229,11
23,16,1
230,11
231,11
232,11
233,12
234,12
235,12
236,13
237,13
238,14
239,14
24,16,1
240,14
241,14
242,14
243,14
245,14
246,14
247,14
248,14
249,14
25,16,1
250,14
252,14
253,14
254,14
255,14
256,14
257,14
258,14
259,14
26,16,1
260,14
261,14
262,14
263,14
264,14
265,14
266,14
267,14
268,14
269,14
27,16,1
270,14
271,14
272,15
273,15
274,15
275,15
276,15
277,15
278,15
279,15
28,16,1
280,15
281,15
282
283,282
284,282
285,282
286,282
287,282
288,282
289,282
29,16,1
290,282
291,282
292,282
293,282
294,282
295,282
296,86,2
297,86,2
298,86,2
299,86,2
3
30,16,1
300,86,2
301,86,2
302,86,2
303,86,2
304,86,2
305,86,2
309,87,2
31,16,1
310,87,2
311,87,2
312,87,2
313,88,2
314,88,2
315,88,2
316,88,2
317,88,2
318,88,2
319,88,2
32,16,1
320,88,2
322,88,2
323,88,2
324,89,2
325,89,2
326,89,2
327,89,2
328,89,2
329,89,2
33,16,1
330,89,2
331,89,2
332,89,2
333,89,2
334,89,2
335,89,2
336,89,2
337,89,2
338,89,2
339,89,2
34,16,1
340,90,2
341,90,2
342,90,2
343,90,2
344,90,2
345,90,2
346,90,2
347,90,2
348,90,2
349,90,2
35,17,1
350,90,2
351,90,2
352,90,2
353,92,2
354,92,2
355,92,2
356,92,2
357,92,2
358,92,2
359,92,2
36,17,1
360,92,2
361,92,2
362,92,2
363,92,2
364,92,2
365,93,2
366,93,2
367,93,2
368,93,2
369,93,2
37,17,1
370,93,2
371,93,2
372,366,93,2
373,366,93,2
374,366,93,2
375,366,93,2
376,366,93,2
377,366,93,2
378,366,93,2
379,366,93,2
38,17,1
380,366,93,2
381,366,93,2
382,366,93,2
383,366,93,2
384,366,93,2
385,366,93,2
386,366,93,2
387,366,93,2
388,366,93,2
389,366,93,2
39,17,1
390,366,93,2
391,366,93,2
392,366,93,2
393,94,2
394,94,2
395,94,2
396,94,2
397,94,2
398,94,2
399,94,2
4
40,17,1
400,94,2
401,94,2
402,94,2
403,94,2
404,94,2
405,94,2
406,95,2
407,95,2
408,95,2
409,95,2
41,17,1
410,95,2
411,95,2
412,95,2
413,95,2
414,95,2
415,95,2
416,96,2
417,96,2
418,96,2
419,96,2
42,17,1
420,96,2
421,96,2
422,96,2
423,96,2
424,96,2
425,96,2
426,96,2
427,98,2
428,98,2
429,98,2
43,17,1
430,98,2
431,98,2
432,98,2
433,98,2
434,98,2
435,98,2
436,98,2
437,98,2
438,98,2
439,98,2
44,17,1
440,110,4
441,110,4
442,110,4
443,110,4
444,110,4
445,110,4
45,17,1
450,110,4
451,110,4
452,111,4
453,111,4
454,111,4
455,111,4
456,111,4
457,111,4
458,111,4
459,111,4
46,17,1
460,111,4
461,111,4
462,111,4
463,111,4
464,111,4
465,111,4
466,111,4
467,111,4
468,111,4
469,111,4
47,17,1
470,111,4
471,112,4
472,112,4
473,112,4
474,112,4
475,111,4
476,112,4
477,112,4
478,112,4
479,112,4
48,17,1
480,112,4
481,112,4
482,112,4
483,112,4
484,112,4
485,112,4
489,109,3
49,17,1
490,109,3
491,109,3
492,109,3
493,109,3
494,109,3
495,109,3
496,109,3
497,101,3
498,101,3
499,101,3
5
50,17,1
500,101,3
501,101,3
502,101,3
503,101,3
504,101,3
505,102,3
506,102,3
507,102,3
508
509,508
51,17,1
510,508
511,508
512,508
513,508
514,508
515,508
516,508
517,508
518,508
519,508
52,17,1
520,508
521,92,2
522,521,92,2
523,521,92,2
524,521,92,2
525,521,92,2
526,521,92,2
527,521,92,2
528,521,92,2
529,521,92,2
53,17,1
530,521,92,2
531,101,3
532,537,536
533,537,536
534,537,536
535,537,536
536
537,536
538,536
539,234,12
54,17,1
540,234,12
541,234,12
542,234,12
543,234,12
545,234,12
546,234,12
547,234,12
548,282
549,2
55,17,1
550,7
56,17,1
560,3
561,312,87,2
562,130,4
563,234,12
564,130,4
565,7
566,7
567,1
568,130,4
569,7
57,17,1
570,234,12
571,234,12
572,2
573,572,2
574,234,12
58,18,1
59,18,1
6
60,19,1
61,19,1
62,19,1
63,19,1
64,19,1
65,19,1
66,19,1
67,19,1
68,19,1
69,19,1
7
70,19,1
71,20,1
72,20,1
73,20,1
74,20,1
75,20,1
76,20,1
77,20,1
78,21,1
79,21,1
8
80,21,1
81,21,1
82,21,1
83,21,1
84,22,1
85,22,1
86,2
87,2
88,2
89,2
9
90,2
92,2
93,2
94,2
95,2
96,2
97,2
98,2
99,2|||i dunno, man, you lost me somewhere around 237,13 ;)

you're a web guy? then you know that an unlimited number of levels is likely not workable?

how many users are willing to drill down fifteen levels to find where they're going?

if you can limit the hierarchy to some fixed maximum number of levels, then you can use a series of self-joins instead of a recursive query (although of course a recursive query will work with a fixed number of levels too)

perhaps this article may help: Categories and Subcategories (http://sqllessons.com/categories.html)

and yes, there is no problem with fifteen self-joins in a query

:)|||Here is the modified query, the output is still disorganized, it looks closer to what I am looking for though. Can you let me know what needs to be changed?
================================================== ======

WITH Tree(Category_ID, Parent_ID, Category_Name, Path, Hlevel)
AS
(
SELECT Category_ID, Parent_ID, Category_Name, PathID, 0 as Hlevel
FROM Dir_Categories
WHERE Parent_ID = 0
UNION ALL
SELECT e.Category_ID, e.Parent_ID, e.Category_Name, e.PathID, Hlevel + 1
FROM Dir_Categories e
INNER JOIN Tree d
ON e.Parent_ID = d.Category_ID
)
SELECT Category_ID, Parent_ID, HLevel,
Category_Name = Replicate('__', HLevel) + Category_Name, Path
FROM Tree order by Category_ID, Path;
GO|||i dunno, man, you lost me somewhere around 237,13 ;)

you're a web guy? then you know that an unlimited number of levels is likely not workable?

how many users are willing to drill down fifteen levels to find where they're going?

if you can limit the hierarchy to some fixed maximum number of levels, then you can use a series of self-joins instead of a recursive query (although of course a recursive query will work with a fixed number of levels too)

perhaps this article may help: Categories and Subcategories (http://sqllessons.com/categories.html)

and yes, there is no problem with fifteen self-joins in a query

:)

I am not going further deeper than 4 levels. It is a web directory and Search Engines dont go that deep so I keep it no more than four. Again, you are talking about self joins and all that but maybe some examples will help, I will take a look at the article. THanks|||i dunno, man, you lost me somewhere around 237,13 ;)

you're a web guy? then you know that an unlimited number of levels is likely not workable?

how many users are willing to drill down fifteen levels to find where they're going?

if you can limit the hierarchy to some fixed maximum number of levels, then you can use a series of self-joins instead of a recursive query (although of course a recursive query will work with a fixed number of levels too)

perhaps this article may help: Categories and Subcategories (http://sqllessons.com/categories.html)

and yes, there is no problem with fifteen self-joins in a query

:)

Thanks, I applied this query and although it is very useful, it doesnt produce the display that i am looking for. And quite honestly it would be too much coding to take the data and create a fabricated HTML output that looks like a tree. It is the only thing that has worked so far though.

AAAHHHHRRGGG, this is so simple in Oracle, just using Connect By. The problem is that I have a shared windows hosting and they only have SQL server. Oracle hosting is too expensive and for the purpose I am developing this, I want anyone who I extend the code to be able to use SQL shared hosting which is the most common one.

Any other resources or suggestions?|||can you show the query that you tried? because honestly, 4 self-joins is nothing complicated

and would you mind repeating what sort of display you are looking for|||can you show the query that you tried? because honestly, 4 self-joins is nothing complicated

and would you mind repeating what sort of display you are looking for

Here is the query I tried now
===================================
select root.Category_Name as root_name
, down1.category_name as down1_name
, down2.category_name as down2_name
, down3.category_name as down3_name
from Dir_categories as root
left outer
join Dir_categories as down1
on down1.parent_id = root.Category_ID
left outer
join Dir_categories as down2
on down2.parent_id = down1.category_id
left outer
join Dir_categories as down3
on down3.parent_id = down2.category_id
where root.parent_id =0
order
by root_name
, down1_name
, down2_name
, down3_name

It displays something like the below, but that is not what I am looking for. I am looking for a tree view that looks like this. Check this website out http://www.9searches.org/sitemap.asp I did this by doing four queries one inside the other, but it i s too slow. I want performance...
======================================
Business Industry Specific Automotive Auto Sales
Business Industry Specific Automotive Car Accessories
Business Industry Specific Automotive Diesel Mechanics
Business Industry Specific Automotive Exotic and Classic Vehicles
Business Industry Specific Automotive General Enhancements
Business Industry Specific Automotive High Performance
Business Industry Specific Automotive Racing
Business Industry Specific Automotive Repair and Maintenance
Business Industry Specific Automotive Road Services
Business Industry Specific Construction NULL
Business Industry Specific Energy and Utilities NULL
Business Law Branches of Law Disabilities
Business Law Branches of Law Employment
============================================

My initial query was
Here is the modified query, the output is still disorganized, it looks closer to what I am looking for though. Can you let me know what needs to be changed?
================================================== ======

WITH Tree(Category_ID, Parent_ID, Category_Name, Path, Hlevel)
AS
(
SELECT Category_ID, Parent_ID, Category_Name, PathID, 0 as Hlevel
FROM Dir_Categories
WHERE Parent_ID = 0
UNION ALL
SELECT e.Category_ID, e.Parent_ID, e.Category_Name, e.PathID, Hlevel + 1
FROM Dir_Categories e
INNER JOIN Tree d
ON e.Parent_ID = d.Category_ID
)
SELECT Category_ID, Parent_ID, HLevel,
Category_Name = Replicate('__', HLevel) + Category_Name, Path
FROM Tree order by Category_ID, Path;
GO

This query produces this output, Tree like but not within corresponding parent categories
==================================
1 0 0 Arts & Humanities
2 0 0 Business
3 0 0 Children
4 0 0 Computers
5 0 0 Education
6 0 0 Entertainment
7 0 0 Home & Garden
8 0 0 Health & Fitness
9 0 0 News & Politics
10 0 0 People & Society
11 0 0 Real Estate
12 0 0 Recreation & Sports
13 0 0 Science & Technology
14 0 0 Shopping
15 0 0 Travel
16 1 1 |__Books and Literature
17 1 1 |__Philosophy
18 1 1 |__Antiques
19 1 1 |__Arts
20 1 1 |__Humanities
21 1 1 |__Museums
22 1 1 |__Organizations
23 16 2 |__|__Art Books
24 16 2 |__|__Authors
25 16 2 |__|__Banned Books
26 16 2 |__|__Best-Seller Lists
27 16 2 |__|__Bookstores and Booksellers
28 16 2 |__|__Book Reading Groups
29 16 2 |__|__Downloadable Texts
30 16 2 |__|__By Genre
31 16 2 |__|__Magazines and e-Zines
32 16 2 |__|__Periods and Movements
33 16 2 |__|__Publishers
34 16 2 |__|__Reviews
35 17 2 |__|__Academic Departments
36 17 2 |__|__Ancient Greek Philosophy
37 17 2 |__|__Axiology
38 17 2 |__|__Chats and Forums
39 17 2 |__|__Chinese Philosophy
40 17 2 |__|__Continental Philosophy
41 17 2 |__|__Current Movements
42 17 2 |__|__Eastern
43 17 2 |__|__Epistemology
44 17 2 |__|__Ethics
45 17 2 |__|__German Idealism
46 17 2 |__|__History
47 17 2 |__|__Humanism
48 17 2 |__|__Journals
49 17 2 |__|__Logic
50 17 2 |__|__Metaphysics
51 17 2 |__|__New Age
52 17 2 |__|__Organizations
53 17 2 |__|__Personal Pages
54 17 2 |__|__Philosophers
55 17 2 |__|__Philosophy of Religion
56 17 2 |__|__Philosophy of Science
57 17 2 |__|__Reference
58 18 2 |__|__Antique Jewelry
59 18 2 |__|__Restoration
60 19 2 |__|__Animation
61 19 2 |__|__Arts Publications
62 19 2 |__|__Arts Resources
63 19 2 |__|__Art Exhibits
64 19 2 |__|__Cartoons
65 19 2 |__|__Design Arts
66 19 2 |__|__Education
67 19 2 |__|__Museums
68 19 2 |__|__Performing Arts
69 19 2 |__|__Visual Arts
70 19 2 |__|__Writers Resources
71 20 2 |__|__Books and Literature
72 20 2 |__|__Classical Studies
73 20 2 |__|__Cultural Studies
74 20 2 |__|__History
75 20 2 |__|__Languages
76 20 2 |__|__Linguistics
77 20 2 |__|__Philosophy
78 21 2 |__|__Maritime Museums
79 21 2 |__|__Railway Museums
80 21 2 |__|__Aviation Museums
81 21 2 |__|__Children Museums
82 21 2 |__|__Science Museums
83 21 2 |__|__Museums
84 22 2 |__|__National Endowment for the Arts
85 22 2 |__|__National Endowment for the Humanities
86 2 1 |__Comodities
87 2 1 |__Computing
88 2 1 |__Finance
89 2 1 |__Global Commerce and Government
90 2 1 |__Human Resources
92 2 1 |__Industry Specific
93 2 1 |__Law
94 2 1 |__Management
95 2 1 |__News and Resources
96 2 1 |__Non Profit
97 2 1 |__Professional Associations and Organizations
98 2 1 |__Sales and Marketing
99 2 1 |__Small Business
100 3 1 |__Toys
101 3 1 |__Family Entertainment
102 3 1 |__Health
103 3 1 |__Pets and Animals
104 3 1 |__Recreation
105 3 1 |__Schools
106 3 1 |__Sports
107 3 1 |__Nutrition
108 3 1 |__Children Books
109 3 1 |__Computer Related
110 4 1 |__Algorithms
111 4 1 |__Artificial Intelligence|||okay, try this --select root.Category_Name as root_name
, down1.Category_Name as down1_name
, down2.Category_Name as down2_name
, down3.Category_Name as down3_name
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
inner
join Dir_categories as down2
on down2.Parent_ID = down1.Category_ID
inner
join Dir_categories as down3
on down3.Parent_ID = down2.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, down1.Category_Name
, down2.Category_Name
, null
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
inner
join Dir_categories as down2
on down2.Parent_ID = down1.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, down1.Category_Name
, null
, null
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, null
, null
, null
from Dir_categories as root
where root.Parent_ID = 0
order
by root_name
, down1_name
, down2_name
, down3_name|||It is just the output. it does not look like a |__TREE
|__LEAF


View|||okay, you are right, it does not show the |__ marks

note that you need the first 4 columns of the result set in order to sort the results properly

now we add one more column -- a concatenation of your marks, along with the name of the node

so what you will do is run the following query, but display only the 5th column as your hierarchy
select root.Category_Name as root_name
, down1.Category_Name as down1_name
, down2.Category_Name as down2_name
, down3.Category_Name as down3_name
, '|_|_|_' + down3.Category_Name as data_to_display
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
inner
join Dir_categories as down2
on down2.Parent_ID = down1.Category_ID
inner
join Dir_categories as down3
on down3.Parent_ID = down2.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, down1.Category_Name
, down2.Category_Name
, null
, '|_|_' + down2.Category_Name as data_to_display
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
inner
join Dir_categories as down2
on down2.Parent_ID = down1.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, down1.Category_Name
, null
, null
, '|_' + down1.Category_Name as data_to_display
from Dir_categories as root
inner
join Dir_categories as down1
on down1.Parent_ID = root.Category_ID
where root.Parent_ID = 0
UNION ALL
select root.Category_Name
, null
, null
, null
, root.Category_Name as data_to_display
from Dir_categories as root
where root.Parent_ID = 0
order
by root_name
, down1_name
, down2_name
, down3_name

Cannot get "LIKE" to Work in My Query

Excel 2003. SQL Server 2000. I have an Excel module that grabs some data
from an SQL database using an ADODB connection. If I use the following in
the SQL query, it returns no data:
(WHERE INVOICENUMBER LIKE 'MS*')
However, if I use the following, I get all the data I expect:
(WHERE INVOICENUMBER>='MS' AND INVOICENUMBER<='MS9999999999999')
What am I doing wrong? How may I properly use the LIKE phrase? Thanks for
any help.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.orgUse % instead of *.
"Chaplain Doug" <ChaplainDoug@.discussions.microsoft.com> wrote in message
news:2433FFE0-85C8-419F-9EB8-2C3302E5058B@.microsoft.com...
> Excel 2003. SQL Server 2000. I have an Excel module that grabs some data
> from an SQL database using an ADODB connection. If I use the following in
> the SQL query, it returns no data:
> (WHERE INVOICENUMBER LIKE 'MS*')
> However, if I use the following, I get all the data I expect:
> (WHERE INVOICENUMBER>='MS' AND INVOICENUMBER<='MS9999999999999')
> What am I doing wrong? How may I properly use the LIKE phrase? Thanks
for
> any help.
> --
> Dr. Doug Pruiett
> Good News Jail & Prison Ministry
> www.goodnewsjail.org|||in SQL, the wildcard character is % not *. Single character wildcard is _
instead of ?
"Chaplain Doug" <ChaplainDoug@.discussions.microsoft.com> wrote in message
news:2433FFE0-85C8-419F-9EB8-2C3302E5058B@.microsoft.com...
> Excel 2003. SQL Server 2000. I have an Excel module that grabs some data
> from an SQL database using an ADODB connection. If I use the following in
> the SQL query, it returns no data:
> (WHERE INVOICENUMBER LIKE 'MS*')
> However, if I use the following, I get all the data I expect:
> (WHERE INVOICENUMBER>='MS' AND INVOICENUMBER<='MS9999999999999')
> What am I doing wrong? How may I properly use the LIKE phrase? Thanks
> for
> any help.
> --
> Dr. Doug Pruiett
> Good News Jail & Prison Ministry
> www.goodnewsjail.org

Sunday, February 12, 2012

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.FN

Hello i have this query and I havent been able to solve it

Cannot find either column "dbo" or the user-defined function or aggregate "dbo.FN_NIVELCOMPETENCIACARGO", or the name is ambiguous.

I have tried with dbo and withou dbo, specifyng columns inside it,

Thanks

select a.nmempresa,a.nmtipocompetencia, d.dsnombreciclo, c.dsnombrecargo,a.dstipocompetencia, a.dscatalogo,

b.popeso as PesoTipoCompetencia, f.dsnombrecompetencia as Competencia, e.pocompetencia as PesoCompetencia,

g.DSOPCIONESCALA, g.PESO

from

tgsc_tiposcompetencias a, TGSC_TIPOSCOMPETENCIASxcargo b, tgsc_cargos c, tgsc_ciclos d,

tgsc_competenciasxcargo e, tgsc_competencias f,

(select

dbo.FN_NIVELCOMPETENCIACARGO(a.nmempresa,a.nmciclo, a.nmtipocompetencia,c.nmcargo,f.nmcompetencia)) as g

where a.nmempresa=72 and a.nmciclo=9

and b.nmtipocompetencia=a.nmtipocompetencia

and b.nmcargo=10 and b.nmempresa=72 and b.nmciclo=9

and c.nmcargo=10 and c.nmempresa=72 and c.nmciclo=9 and d.nmciclo=9

and e.nmcargo=10 and e.nmciclo=9 and e.nmempresa=72

and f.nmcompetencia=e.nmcompetencia and f.nmtipocompetencia=a.nmtipocompetencia

and f.nmtipocompetencia=b.nmtipocompetencia

Is FN_NIVELCOMPETENCIACARGO a table valued function? The select you are using is for scalar functions. If it is a TVF, change

(select

dbo.FN_NIVELCOMPETENCIACARGO(a.nmempresa,a.nmciclo, a.nmtipocompetencia,c.nmcargo,f.nmcompetencia)) as g

to

dbo.FN_NIVELCOMPETENCIACARGO(a.nmempresa,a.nmciclo, a.nmtipocompetencia,c.nmcargo,f.nmcompetencia) as g

|||

I changed to this

select a.nmempresa,a.nmtipocompetencia, e.nmcompetencia, d.dsnombreciclo, c.dsnombrecargo,a.dstipocompetencia, a.dscatalogo,

b.popeso as PesoTipoCompetencia, f.dsnombrecompetencia as Competencia, e.pocompetencia as PesoCompetencia

from

tgsc_tiposcompetencias a,

TGSC_TIPOSCOMPETENCIASxcargo b,

tgsc_cargos c,

tgsc_ciclos d,

tgsc_competenciasxcargo e, tgsc_competencias f,

dbo.FN_NIVELCOMPETENCIACARGO(a.nmempresa,a.nmciclo, a.nmtipocompetencia,c.nmcargo,f.nmcompetencia) as g

where a.nmempresa=72 and a.nmciclo=9

and b.nmtipocompetencia=a.nmtipocompetencia

and b.nmcargo=10 and b.nmempresa=72 and b.nmciclo=9

and c.nmcargo=10 and c.nmempresa=72 and c.nmciclo=9 and d.nmciclo=9

and e.nmcargo=10 and e.nmciclo=9 and e.nmempresa=72

and f.nmcompetencia=e.nmcompetencia and f.nmtipocompetencia=a.nmtipocompetencia

and f.nmtipocompetencia=b.nmtipocompetencia

Now the error is this

Msg 4104, Level 16, State 1, Line 1

The multi-part identifier "a.nmempresa" could not be bound.

Msg 4104, Level 16, State 1, Line 1

The multi-part identifier "a.nmciclo" could not be bound.

Msg 4104, Level 16, State 1, Line 1

The multi-part identifier "a.nmtipocompetencia" could not be bound.

Msg 4104, Level 16, State 1, Line 1

The multi-part identifier "c.nmcargo" could not be bound.

Msg 4104, Level 16, State 1, Line 1

The multi-part identifier "f.nmcompetencia" could not be bound.

|||Is dbo.FN_NIVELCOMPETENCIACARGO a TVF or scalar function?|||TVF|||

If your intent is to execute the TVF for each row returned by your query, then this will work.

Change to

select tvf1.*, t1.* from (

select a.nmempresa,a.nmtipocompetencia, e.nmcompetencia, d.dsnombreciclo, c.dsnombrecargo,a.dstipocompetencia, a.dscatalogo,

b.popeso as PesoTipoCompetencia, f.dsnombrecompetencia as Competencia, e.pocompetencia as PesoCompetencia

from

tgsc_tiposcompetencias a,

TGSC_TIPOSCOMPETENCIASxcargo b,

tgsc_cargos c,

tgsc_ciclos d,

tgsc_competenciasxcargo e, tgsc_competencias f

where a.nmempresa=72 and a.nmciclo=9

and b.nmtipocompetencia=a.nmtipocompetencia

and b.nmcargo=10 and b.nmempresa=72 and b.nmciclo=9

and c.nmcargo=10 and c.nmempresa=72 and c.nmciclo=9 and d.nmciclo=9

and e.nmcargo=10 and e.nmciclo=9 and e.nmempresa=72

and f.nmcompetencia=e.nmcompetencia and f.nmtipocompetencia=a.nmtipocompetencia

and f.nmtipocompetencia=b.nmtipocompetencia) as t1 CROSS APPLY dbo.FN_NIVELCOMPETENCIACARGO(t1.nmempresa,t1.nmciclo, t1.nmtipocompetencia, t1.nmcargo,t1.nmcompetencia) as tvf1

|||Thank you very much ; I will try and If i am having problems I will come back here.