Showing posts with label hai. Show all posts
Showing posts with label hai. Show all posts

Friday, March 30, 2012

Problem in inner join ?

Hai ,

select emp_id,count(emp_id) as count1 from poll_data group by emp_id order by count1 desc

The output of above query is

emp_id count1

EMP10041 8
EMP10058 8
EMP10059 6
EMP10008 6
EMP10012 3
EMP10018 3
EMP10039 3
EMP10001 2

I have another table as user_table

user_id user_name

EMP10001 Raja
EMP10039 Ram
EMP10018 Ravi

etc

now i am writing a inner join as follows

select y.user_name, x.count1 from [select emp_id,count(emp_id) as count1 from poll_data group by emp_id order by count1 desc] x inner join [user_table] y on x.emp_id = y.user_id

I want to get the below format

Jambu 8
Elangovan 8
Ravi 6
Anitha 6
Ram 3

but i am getting the below error :

Invalid object name 'select emp_id,count(emp_id) as count1 from poll_data group by emp_id order by count1 desc

how to solve this

remove the [ ] & order by clasue on the sub query. Sub query should be enclosed with ( ).

Code Snippet

select

y.user_name

, x.count1

from

(select emp_id,count(emp_id) as count1 from poll_data group by emp_id) x

inner join [user_table] y on x.emp_id = y.user_id

|||

You need to enclose the derived table in parentheses -NOT square brackets.

Code Snippet


SELECT
u.User_Name,
p.Count1
FROM (SELECT
Emp_ID,
Count1 = count(Emp_ID)
FROM Poll_Data
GROUP BY Emp_ID
) p
INNER JOIN User_Table u
ON p.Emp_ID = u.User_ID

Monday, March 26, 2012

Problem in Converting Task to DataPumpTask2

Hai All,

I tried to convert a Task to DataPumpTask2.

But i got an Error

An unhandled exception of type 'System.InvalidCastException' occurred

QueryInterface for interface DTS.CustomTask failed

I installed SP3 for SqlServer in my Desktop and in the Server itself.

But i faced the same problem again.

If anyone have idea please enligten me .

Thanx,

Karthik.A

Hai All,

I found the Solution.

What we have to do is,Just install the SP3 for desktop SQL2KDeskSP3.exe in ur Machine.

While installation, it asks for "sa" Password.

Just open the setup.ini in the Extracted folder sql2ksp3/MSDE/setup.ini

and add PWD sa = <Password> below the [options].

then it starts installation.Once it's completed .

Compile ur code.it runs successfully.

Thanx,

Karthik.A

Friday, March 23, 2012

Problem in Chart

Hai all,

I am generating chart using the Sql Reporting services.I have done 2 charts. when i am clicking one chart it will navigate to another chart.It is happened in reports.

when i used in UI page(web Page). when click the chart it is not navigating to another chart.The same chart will appear when i click the chart.

Can u guys help me soon to solve this problem..

Thanks In advance.

Double click the original chart and right click the field that you want to navigate to the other chart. Click properties. Click the action tab. Select the Jump to report radio button. In the drop down menu, select the second chart that you would like the original chart to navigate to.