我試圖做到這一點在我的存儲過程:如何將一個SELECT語句的值賦給一個變量?
declare @CategoryId int -- stuff IF EXISTS (select A_categoryId from dbo.categories where B_categoryId = @b_categoryId and C_cactegoryId = @c_categoryId ) -- it doesn't like the following line: @CategoryId = select A_categoryId from dbo.categories where B_categoryId = @b_categoryId and C_cactegoryId = @c_categoryId
,但它不喜歡它的結構化的方式。有任何想法嗎?
@downvoter -care評論? – Didaxis