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.
| Author |
Topic |
|
tedmanowar
Starting Member
31 Posts |
Posted - 2007-03-20 : 04:44:51
|
| Hello,I am having a strange problem when trying to execute this command:SET @chari = cast(@i as varchar(4)) SET @PriceBeforeCommission = (SELECT CONVERT(decimal(10,2), HistoryData.value('(/row/@PriceBeforeCommission)[' + @chari + ']', 'nvarchar(MAX)')) FROM ReservationDetails WHERE fk_HotelID=@HotelID AND fk_ReservationID=@ReservationID)The problem occurs because of the variable @chari that I am trying to concatenate.The error I am getting is the following:Msg 8172, Level 16, State 1, Procedure TEST_REVENUE_PROFIT, Line 78The argument 1 of the xml data type method "value" must be a string literal.Can anyone help ?TedManowarTedManowar |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-03-20 : 08:14:17
|
| >> '(/row/@PriceBeforeCommission)[' + @chari + ']'This nneds to be a literal not an expression.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|