Showing posts with label write. Show all posts
Showing posts with label write. Show all posts

Monday, March 26, 2012

How to connect to AS 2000

Hi all,

Currently I am working on the Window 2003 Enterprise 64-bit with SQL 2005 Enterprise and Visual Studio Professional install. I try to write a console application using Visual Studio to connect to the Analysis Server 2000, but I get the follow error message:

ErrorTongue Tiedystem.Runtime.InteropServices.COMException (0x800A0E7A): Provider cannot be found. It may not be properly installed.
at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
at ExceptionCheck.Module1.Hodb03_ItemSales() in Z:\Visual Studio\Console\ExceptionCheck\ExceptionCheck\Module1.vb:line 16"

I know if I want to connect to the Analysis Service 2000, I need to install the Microsoft SQL Server 2000 PivotTable Services. After I install the services, I still get the error message.

Thanks,

Tomas

Hi,

Try to re-register msolap (regsvr32 msolap80.dll from "%ProgramFiles%\Common Files\System\Ole DB"). If you get the same error, let's check with the MDX Sample application (ships with AS2000, you can copy it from another machine). If you get the same error, then you probably have corrupted installation of the Pivot Table Service.

|||

Hi,

I tried to re-register msolap, but it didn't help.

|||The MDX Sample application failed with the same error ? Beside re-installing PTS, can't think of something else.

Friday, March 9, 2012

how to concatenate the xml returned in different rows, and different select statements

hi
How would I write my query to concatenate the xml segment returned from
different rows, and from different select statements
Look at FOR XML...
E.g.,
declare @.x1 xml, @.x2 xml;
set @.x1 = '<a/>';
set @.x2 = '<b/>';
select @.x1, @.x2 for xml path(''), type
Best regards
Michael
"joyce chan" <joyceschan@.fastmail.fm> wrote in message
news:1169742062.183408.76500@.j27g2000cwj.googlegro ups.com...
> hi
> How would I write my query to concatenate the xml segment returned from
> different rows, and from different select statements
>
|||I would recommend you go with FOR XML, as Michael Rys suggested. However, if for
some reason you're unable or not willing to use that method, you can always
convert your instances to a string type, concatenate them, and convert back to
XML
Denis Ruckebusch
http://blogs.msdn.com/denisruc
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"joyce chan" <joyceschan@.fastmail.fm> wrote in message
news:1169742062.183408.76500@.j27g2000cwj.googlegro ups.com...
> hi
> How would I write my query to concatenate the xml segment returned from
> different rows, and from different select statements
>

Wednesday, March 7, 2012

How to Compare 2007-9-11 and Month(GetDate()) ?

I am going to compare thie value 2007-9-11 (this value was retrived from the column(TxnDate) in my DataBase, type is DateTime)

I write code

select * from ZT_ModifyLog where Year(TXnDate) = Year(GetDate()) AND ( ( Month(TXnDate) < Month(GetDate()) ) and Month(TXnDate) >= Month(GetDate())-1)

it will like

select * from ZT_ModifyLog where Year(2007-9-11 ) = Year(GetDate()) AND ( ( Month(2007-9-11 ) < Month(GetDate()) ) and Month(2007-9-11 ) >= Month(GetDate())-1)

→ select * from ZT_ModifyLog where TxnDate(2007) = 2007 AND 10 < GetDate(10) and 9 >= 9 so return TXnDate between 2007/9/1~ 2007/9/30

but what if Month(GetDate())-13)?? when the -1 biger than 12... I guess the code will cause error ... but can't think out how to avoid and change my code

pleae help... thank you very much

Please do not open multiple threads for same question. Refer:http://forums.asp.net/t/1176161.aspx.

Friday, February 24, 2012

How to Combine two column in one table using SQL statement ?

Could you write the simple SQL statement from 'Combine two column in one table '?

I try to use 'Union' which combine two column in two table . thxYou can use the concatention operator (+):


SELECT
column1 + column2 AS myColumn
FROM
myTable

Terri|||If the columns are numeric then "+" will sum the column values.
If you do not desire this, you should use str() function

Check the below statement,

select ltrim(str(column1)) + ltrim(str(column2)) from mytable

how to code sql comments within sql statement


I want to write a query like this:

select ' select count(*) '+ '/*' + table_name + '*/' + char(10) + ' FROM '+table_name...

The result should looks like this:

--
select count(*) /* - emp_name */
FROM emp_name

query result:

COUNT(*)-EMP_NAME
-
3

-
But, now I can only got

COUNT(*)
-
3

What's wrong with my original code?Actually, I am getting


- as the result, I think I just need to find out how to turn headings on.
3

Thanks|||

Well... you are comment out whatever is written. Comment out means that it will be ignored, it will not show up in the results, etc.

It looks like you want to create column headers for aggregrated columns. Fortunately, you can use an ALIAS for that task.

For example:

Code Snippet


SELECT
count(*) AS 'count(*) --Emp_Name'
FROM MyTable

Of course, whatever is typed as the ALIAS has to be know in advance, it will not dynamically put in the column or table name.

|||
Thanks, Arnie:

I got it now.