Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exec Sp_ExecuteSQL @SQL 1

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Jan 26, 2001
522
US
I get the following error:

Cannot convert parameter '@statement' to ntext/nchar/nvarchar data type expected by procedure.

when I run my stored procedure below. Of course the code below is just the portion of the stored procedure which gives me this error.

Declare @SQL VarChar(1024)
Set @SQL =
'Select
Hawb.cHawbNum
, Hawb.dShipDate
, Hawb.cOrigin
, Hawb.cDestin
, HawbDetail.cCustcode
, HawbDetail.dDueDate
, #TmpHawbsNoDoc.cDocType
From Hawb (nolock)
Join HawbDetail (nolock) on Hawb.cHawbNum = HawbDetail.cHawbNum
Join #TmpHawbsNoDoc On Hawb.cHawbNum = #TmpHawbsNoDoc.cHawbNum
Order By ' +
Case @cDocType
When Null Then 'cCustCode, cOrigin, dShipDate'
When "INLND_BL" Then 'cCustCode, cOrigin, dShipDate'
When "PO" Then 'cCustCode, cOrigin, dShipDate'
When "HAWB" Then 'cCustCode, cOrigin, dShipDate'
When "POD" Then 'cCustCode, cDestin, dShipDate'
End

Exec Sp_ExecuteSQL @SQL
GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top