@swasheck nah. MVP doesn't signify expertise :-) I've plenty to learn about plenty (in SQL and in the Bible.. Actually everywhere, come to think of it)
I'm trying to create a stored procedure that contains a dynamic query. My reason for using a dynamic query is that I need to pass between 0 and 3 parameters to the same query.
Right now, when I run the procedure, I get the following error:
Msg 102, Level 15, State 1, Line 1
Incorrect synta...
Me: Why does everything have to be so complicated when just trying to do simple things in Oracle? Them: Oracle is that way because it can run on any OS and is portable. Me: So it's a worst common denominator database.
I have 2 tables I am working with.
Table 1 has 10 categories, entries do not change. unless I change.
Cat_NO | Cause
1 = Animal
2 = Bird
3 = Bear
4 = Dog
5 = Snake
6 = Human
7 = Cow
8 = Car
9 = Fire
10 = Rain
Table 2 has data coming randomly wh...
Title says it all. I had a situation where a moderator answered a question and then marked another answer (that said the same thing, but more directly) for conversion to comment because they felt "its length was not up to community standards".
While I think it is important to maintain some set ...
@JNK I believe that those comments were deleted, I didn't see them. But, the poster didn't seem to acknowledge that CasperOne didn't deleted his answer
create procedure test
as
BEGIN
SET NOCOUNT ON
select * from sys.tables
END
GO
@CadeRoux i'm convinced he's got a rogue ' in the dynamic query ... OP is not using QUOTENAME ... and OP could just have a dynamic query that is > 4000 characters
@swasheck Yeah - probably a parenthesis in one of the lists which are concatenated into his query. The whole thing should probably be done to table-valued parameters and no need for dynamic SQL.
@JNK @Lamak i'm just going to wade in and drop a comment that says "your hate has made you powerful. Now fulfill your destiny and take casperOne's place at Shog9's side."