Maximum length of VARCHAR
From: Chandler Chao (ChandlerChao_at_discussions.microsoft.com)
Date: 10/20/04
- Next message: Costi Stan: "Re: ALTER TABLE: drop all objects and recreate them."
- Previous message: Jeff Dillon: "Re: Windows authentication on SQL server"
- Next in thread: Chandler Chao: "RE: Maximum length of VARCHAR"
- Reply: Chandler Chao: "RE: Maximum length of VARCHAR"
- Reply: Zach Wells: "Re: Maximum length of VARCHAR"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 20 Oct 2004 09:19:07 -0700
I'm having trouble exceeding 256 characters in a variable I declare in my
stored procedure. I've included the stored procedure below as well as the
output. The reason that I'm writing my sp this way is that the input
variable, @LeadList, is a list of comma seperated numbers. It is the @SQL
variable that does not seem to want to exceed 256 characters no matter how
large I declare it. Could someone help me out?
----------------------------------------------------------------------------------
CREATE PROCEDURE sp_Web_GetDocs
@LeadList varchar(256)
AS
BEGIN
DECLARE @SQL varchar(600)
SET @SQL = CONVERT(VARCHAR(600),'SELECT Documents.FileName,
Documents.FilePath, LeadAttachments.LeadID, Leads.Subject, Leads.Event,
Documents.Description
FROM LeadAttachments INNER JOIN Documents ON LeadAttachments.DocumentID =
Documents.DocumentID
INNER JOIN Leads ON LeadAttachments.LeadID = Leads.LeadID
INNER JOIN DocumentTypes ON DocumentTypes.DocumentTypeID =
Documents.DocumentTypeID W
HERE DocumentTypes.FileExtension <>''RTF''AND LeadAttachments.LeadID IN
('+@LeadList + ')
ORDER BY Leads.Subject DESC, DocumentTypes.PrintPriority DESC')
SELECT @SQL
--EXEC (@SQL)
END
GO
----------------------------------------------------------
Output
SELECT Documents.FileName, Documents.FilePath, LeadAttachments.LeadID,
Leads.Subject, Leads.Event, Documents.Description
FROM LeadAttachments INNER JOIN Documents ON LeadAttachments.DocumentID =
Documents.DocumentID
INNER JOIN Leads ON LeadAttachments.
- Next message: Costi Stan: "Re: ALTER TABLE: drop all objects and recreate them."
- Previous message: Jeff Dillon: "Re: Windows authentication on SQL server"
- Next in thread: Chandler Chao: "RE: Maximum length of VARCHAR"
- Reply: Chandler Chao: "RE: Maximum length of VARCHAR"
- Reply: Zach Wells: "Re: Maximum length of VARCHAR"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|