Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 2 Problems in Query

Author  Topic 

fholemans
Starting Member

12 Posts

Posted - 2012-10-25 : 08:32:44
Hello,

I have two problems when I execute a query:

- First of all when I will execute this query, it says that I have a syntax problem with '='(in bold).

Update tblFactMGMTAPP

SET DIRECTIONS='DIR_MAG' , M_ACCOUNT='M801'
WHERE PISTES='PIMFR' and M_ACCOUNT='M402' and GROUPS='LC'


SET DIRECTIONS='DIR_MAG' , M_ACCOUNT='M802'
WHERE PISTES='PIMFR' and M_ACCOUNT='M403' and GROUPS='LC'

But I don't understand why because my first query (in orange) works without any problems.

Secondly, I have a dimension which has a number of members with the same root :

PIMIT
PIMFR
PIMDE
PIMES
PIMPT
...

And I want to know if it exists a symbol/a way to write only PIM.. and the query will find every member of the specific dimension.
So I can write PISTES='PIM..'
I have tried with the symbol '%' but it doesn't work.
So I can write PISTES='PIM...'

Thanks in advance.


bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-10-25 : 08:43:51

And I want to know if it exists a symbol/a way to write only PIM.. and the query will find every member of the specific dimension.
So I can write PISTES='PIM..'
I have tried with the symbol '%' but it doesn't work.
So I can write PISTES='PIM...'


WHERE PISTES LIKE 'PIM%'


--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-25 : 10:08:55
you cant write multiple updates like this

it has to be

Update tblFactMGMTAPP
SET DIRECTIONS='DIR_MAG' , M_ACCOUNT='M801'
WHERE PISTES='PIMFR' and M_ACCOUNT='M402' and GROUPS='LC'


Update tblFactMGMTAPP
SET DIRECTIONS='DIR_MAG' , M_ACCOUNT='M802'
WHERE PISTES='PIMFR' and M_ACCOUNT='M403' and GROUPS='LC'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -