SQL Server QOD
You are building a stored procedure for a quote generator in SQL Server 2000.
You have this stored procedure, but seem to be having trouble with quote 1, but not quote 2. What's wrong:
create procedure spQuoteGrab
@quoteid int
as
declare @quote varchar(100)
select @quote = convert( varchar, quotetext)
from
quotes
where
quoteid = @quoteid
select @quote 'quote'
return
Tuples of the table quotes
quoteid quotetext
------- --------------------
1 Now is the time for all good men to come to the aid of their country
2 Seize the day
Answer:
The first quote is truncated because no size is specified in the CONVERT function.SQL 2000 takes the length to be 30 by default
For further reading:
http://msdn.microsoft.com/library/en-us/tsqlref/ts_ca-co_7tpu.asp
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home