Viewing 15 posts - 4,096 through 4,110 (of 5,502 total)
lmu92 (3/3/2010)
Add a line break before your GO statements:
SET @SQL ='USE '+@DESDB+'GO '
SET @SQL = @SQL+'
CREATE VIEW '+@NAME+' AS SELECT * FROM '+@BASEDB+'.DBO.'+@NAME+'
GO'
Did you even tried that code???
There...
March 3, 2010 at 4:21 pm
BaldingLoopMan (3/3/2010)
... I think he means. ...
That's one possible direction. But instead of guessing I'd like to know.
March 3, 2010 at 4:17 pm
balbirsinghsodhi (3/3/2010)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'GO'.
Msg 111, Level 15, State 1, Line 2
'CREATE VIEW' must be the first...
March 3, 2010 at 3:00 pm
It depends on several things:
What is the format the original values are stored as?
How do you want to display times before 10:00 (w/ or w/o leading zero)?
Why is'n it stored...
March 3, 2010 at 2:56 pm
If you compare ALZDBA's solution and mine you should focus on the different interpretation of where the ORDER BY section would apply to.
Also you'll see a difference if you have...
March 3, 2010 at 2:36 pm
The disadvantage of your solution is that you have to have a aclumn named "deed_name" within each table you want to apply that dynamic query to.
Therefore, I decided to use...
March 3, 2010 at 2:24 pm
Add a line break before your GO statements:
SET @SQL ='USE '+@DESDB+'
GO '
SET @SQL = @SQL+'
CREATE VIEW '+@NAME+' AS SELECT * FROM '+@BASEDB+'.DBO.'+@NAME+'
GO'
March 3, 2010 at 1:54 pm
Unfortunately, your sample code won't run since you defined ID as being identity but you're trying to insert value 13 for every row.
Please clean up your sample code and run...
March 3, 2010 at 1:37 pm
Would something like the following will do it?
Side note: this will only work if you always provide an ORDER BY clause since this is required for the ROW_NUMBER function....
SELECT @V_QUERY_STR...
March 3, 2010 at 1:34 pm
First of all: thank your for taking the time to set up the sample data!!
Made it really easy to work on! Great job :Wow:
Here's what I came up with:
;WITH cte...
March 3, 2010 at 1:24 pm
Would you please provide table def, some sample data and expected result? I'm sure it's possible to do it without dynamic sql but I'd like to have something to play...
March 3, 2010 at 12:15 pm
Instead of that verbal description would you mind setting up some table definition (target table), input values that are provided and expected result set in your target table.
If you'd like...
March 3, 2010 at 12:11 pm
Try the following:
Open Query Editor (or whatever the name was back in SQL 2000... I simply forgot). Highlight the word "sysobjects" and press {F1}. IIRC it will open the...
March 3, 2010 at 12:08 pm
Jeff Kring (3/3/2010)
I did look into ROW_NUMBER as an option. I could use it to return the correct rows, but the application needs the actual value as well.
I don't...
March 3, 2010 at 11:59 am
Viewing 15 posts - 4,096 through 4,110 (of 5,502 total)