Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 The crosstab proc from SQLTeam Article not working
 Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

SwePeso
Patron Saint of Lost Yaks

Sweden
30421 Posts

Posted - 08/10/2008 :  14:31:06  Show Profile  Visit SwePeso's Homepage  Reply with Quote
create procedure gw
(
	@hotel varchar(200),
	@roomtype varchar(30),
	@datebegin smalldatetime,
	@dateend smalldatetime
)
as

set nocount on

declare	@sql varchar(max)

set	@sql = 'select da_date from greatwolfcleanedup where location like ' + quotename('%' + @hotel + '%', '''') + ' and roomtype like ' + quotename('%' + @roomtype + '%', '''') + ' and da_date >= ''' + convert(varchar(25), @datebegin, 112) + ''' and da_date < ''' + convert(varchar(25), dateadd(day, 1, @dateend), 112) + ''' group by da_date order by da_date'

execute crosstab	@sql,
			'min(da_rate)',
			'executiontime',
			'greatwolfcleanedup'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

blindman
Flowing Fount of Yak Knowledge

USA
2365 Posts

Posted - 08/10/2008 :  17:32:04  Show Profile  Reply with Quote
quote:
Originally posted by Peso

Am I talking to blind people?
Use QUOTENAME.
Uhm....most blind people can hear quite well...

Boycott Beijing Olympics 2008
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000