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 |
|
vimaldreams
Starting Member
17 Posts |
Posted - 2010-11-01 : 09:51:01
|
| I have created this SP and when am tryng to execute the SPAM getting the error:Msg 208, Level 16, State 6, Procedure sp_searchdata, Line 26Invalid object name 'dbo.sp_searchdata'.Any help would be appreciatedSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================ALTER PROCEDURE [dbo].[sp_searchdata](@mode VARCHAR(20)='select',@searchfield VARCHAR(50)='DropDownList1.SelectedItem.Text',@searchvalue VARCHAR(50)='TextBox1.Text')WITH EXECUTE AS 'dbo' ASBEGINDECLARE @STR VARCHAR(2000)IF @mode='select'BEGIN SELECT @STR = 'select * from MK_DB' IF @searchfield <> '' AND @searchvalue <> '' BEGIN SELECT @STR = @STR + ' Where ' + @searchfield + ' like ' + '''' + @searchvalue + '%'+ '''' END PRINT(@STR) EXEC(@STR)ENDEND |
|
|
vimaldreams
Starting Member
17 Posts |
Posted - 2010-11-01 : 10:09:43
|
| Any help would be greatly appreciated |
 |
|
|
vimaldreams
Starting Member
17 Posts |
Posted - 2010-11-01 : 10:25:17
|
| I found the solution:This line of code ALTER PROCEDURE [dbo].[sp_searchdata]is replaced by CREATE PROCEDURE sp_searchdata_SELECT |
 |
|
|
|
|
|