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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 stored procedure help

Author  Topic 

maddyslayer
Yak Posting Veteran

57 Posts

Posted - 2012-02-29 : 14:36:02
I run the stored procedur


SET @industryCriteria = N''
IF @RegulatedOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND usi.regStatusType = 1'
END

I get the following error that says

Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "usi.regstatusType" could not be bound.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-29 : 14:42:18
the error is not here but place where you're trying to execute it in EXEC

check if you've column regStatusType present in table referred by alias usi

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-29 : 14:43:39
I have no problem. You need to post more of your code



DECLARE @industryCriteria varchar(8000), @RegulatedOnly int

SET @RegulatedOnly = 1
SET @industryCriteria = N''

IF @RegulatedOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND usi.regStatusType = 1'
END




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

maddyslayer
Yak Posting Veteran

57 Posts

Posted - 2012-02-29 : 14:51:49
Here's all my code

USE [IURC]
GO
/****** Object: StoredProcedure [dbo].[Polaris_ReportSP_Rates_Addresses] Script Date: 02/29/2012 14:45:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object: StoredProcedure [dbo].[Polaris_ReportSP_Rates_Addresses] Script Date: 06/21/2011 1:45:00 ******/

/************************************************************************************************
** Name : Polaris_ReportSP_Rates_Addresses
** Last Updated : 6/21/2011
** Purpose : Selects the information for the Rates Addresses Report.
** Changes : (6/13/11) Updated revised SP to work around missing addresses with subindustries (telecom)
** : (6/21/11) Fixed problem bring in other industries (ie. Video) with NULL subindustries
** Author : Kevin Dostalek
*************************************************************************************************/

ALTER PROCEDURE [dbo].[Polaris_ReportSP_Rates_Addresses]
@IndustryID INT = 0,
@Category INT = 0,
@RegulatedOnly BIT = 0,
@ArRequiredOnly BIT = 0,
@FeeBilledOnly BIT = 0,
@ReportClass INT = 0,
@SortBy1 CHAR(1) = NULL,
@SortBy2 CHAR(1) = NULL,
@SortBy3 CHAR(1) = NULL
AS

DECLARE @strSQL NVARCHAR(3000)
DECLARE @orderBy NVARCHAR(2000)
DECLARE @orderByCount INT
DECLARE @industryCriteria NVARCHAR(500)

SET NOCOUNT ON

SET @industryCriteria = N''
IF @RegulatedOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' usi.regStatusType = 1'
END
IF @ArRequiredOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND ui.requiresAnnualRpt = 1'
END
IF @ReportClass <> 0
BEGIN
SET @industryCriteria = @industryCriteria + N' AND ar.ReportClass = ' + CAST(@ReportClass AS NVARCHAR(15))
END

SET @strSQL = N'SELECT DISTINCT u.UtilityID, it.TypeID AS IndustryTypeID, '

IF @IndustryID = 0
SET @strSQL = @strSQL + N'''Water/Sewer'''
ELSE
SET @strSQL = @strSQL + N'it.Description'

SET @strSQL = @strSQL + N' AS Industry,
uot.Description AS Ownership, arct.Description AS ReportClassDescription, u.Name AS UtilityName,
ua.AttnName, ua.AddrLine1, ua.AddrLine2, ua.City,
usp.Name AS State, ua.PostalCode, ua.Phone, uc.Name AS Country
FROM UtilityIndustry ui
INNER JOIN IndustryTypes it ON ui.IndustryType = it.TypeID
INNER JOIN Utility u ON ui.UtilityID = u.UtilityID
INNER JOIN UtilityOwnershipTypes uot ON u.OwnershipType = uot.TypeID

INNER JOIN UtilityAddress ua ON ui.IndustryID = ua.UtilityIndustryID and ua.AddressType = 1
INNER JOIN URCStateProvince usp ON ua.StateID = usp.StateID
INNER JOIN URCCountry uc ON ua.CountryID = uc.CountryID

inner join
(
select u3.utilityid, sit3.description as [description], rst3.description as [status]
from utility u3
inner join utilityindustry i3 on u3.utilityid=i3.utilityid
inner join utilitysubindustry si3 on i3.industryid=si3.industryid
inner join utilityregstatus rs3 on si3.subindustryid=rs3.subindustryid
inner join regulatorystatustypes rst3 on rs3.statustype=rst3.typeid
left outer join subindustrytypes sit3 on si3.subindustrytype=sit3.typeid
where rs3.dateeffective=(select max(dateeffective) from utilityregstatus where subindustryid=rs3.subindustryid)
) as sit on u.utilityid=sit.utilityid

LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
LEFT OUTER JOIN AnnualReport ar ON ui.IndustryID = ar.UtilityIndustryID AND ly.LastYearOnFile = ar.Year
LEFT OUTER JOIN AnnualReportClassTypes arct ON ar.ReportClass = arct.TypeID
WHERE '

-- If industry = 0 then water/sewer
IF @IndustryID = 0
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct ui.utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
LEFT OUTER JOIN AnnualReport ar ON ui.IndustryID = ar.UtilityIndustryID AND ly.LastYearOnFile = ar.Year
WHERE industryType = 3' + @industryCriteria + ') AND ui.UtilityID in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ')'
END
ELSE IF @IndustryID = 3
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 3' + @industryCriteria + ') AND ui.UtilityID not in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ')'
END
ELSE IF @IndustryID = 4
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct ui.utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ') AND ui.UtilityID not in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 3' + @industryCriteria + ')'
END
ELSE
BEGIN
SET @strSQL = @strSQL + 'ui.IndustryType = ' + CAST(@IndustryID AS NVARCHAR(15)) + @industryCriteria
END

IF @FeeBilledOnly = 1
BEGIN
SET @strSQL = @strSQL + ' AND u.feeBill = ''YES'''
END

If @Category = 1
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'', ''CLEC-R'')'
END

If @Category = 2
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'')'
END

If @Category = 3
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-R'')'
END

If @Category = 4
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''AOS'')'
END

If @Category = 5
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CAP'')'
END

If @Category = 7
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''WIRELESS'')'
END

If @Category = 9
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'', ''AOS'', ''CAP'', ''IXC'', ''WIRELESS'')'
END

quote:
Originally posted by X002548

I have no problem. You need to post more of your code



DECLARE @industryCriteria varchar(8000), @RegulatedOnly int

SET @RegulatedOnly = 1
SET @industryCriteria = N''

IF @RegulatedOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND usi.regStatusType = 1'
END




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/




Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-29 : 15:00:38
So where's the execute?

Do a PRINT of @strSQ and see what was created...post that here

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

maddyslayer
Yak Posting Veteran

57 Posts

Posted - 2012-02-29 : 15:14:39
Here's the complete code along with exec

USE [IURC]
GO
/****** Object: StoredProcedure [dbo].[Polaris_ReportSP_Rates_Addresses] Script Date: 02/29/2012 14:45:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object: StoredProcedure [dbo].[Polaris_ReportSP_Rates_Addresses] Script Date: 06/21/2011 1:45:00 ******/

/************************************************************************************************
** Name : Polaris_ReportSP_Rates_Addresses
** Last Updated : 6/21/2011
** Purpose : Selects the information for the Rates Addresses Report.
** Changes : (6/13/11) Updated revised SP to work around missing addresses with subindustries (telecom)
** : (6/21/11) Fixed problem bring in other industries (ie. Video) with NULL subindustries
** Author : Kevin Dostalek
*************************************************************************************************/

ALTER PROCEDURE [dbo].[Polaris_ReportSP_Rates_Addresses]
@IndustryID INT = 0,
@Category INT = 0,
@RegulatedOnly BIT = 0,
@ArRequiredOnly BIT = 0,
@FeeBilledOnly BIT = 0,
@ReportClass INT = 0,
@SortBy1 CHAR(1) = NULL,
@SortBy2 CHAR(1) = NULL,
@SortBy3 CHAR(1) = NULL
AS

DECLARE @strSQL NVARCHAR(3000)
DECLARE @orderBy NVARCHAR(2000)
DECLARE @orderByCount INT
DECLARE @industryCriteria NVARCHAR(500)

SET NOCOUNT ON

SET @industryCriteria = N''
IF @RegulatedOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND sit.Status = ''Regulated'''
END
IF @ArRequiredOnly = 1
BEGIN
SET @industryCriteria = @industryCriteria + N' AND ui.requiresAnnualRpt = 1'
END
IF @ReportClass <> 0
BEGIN
SET @industryCriteria = @industryCriteria + N' AND ar.ReportClass = ' + CAST(@ReportClass AS NVARCHAR(15))
END

SET @strSQL = N'SELECT DISTINCT u.UtilityID, it.TypeID AS IndustryTypeID, '

IF @IndustryID = 0
SET @strSQL = @strSQL + N'''Water/Sewer'''
ELSE
SET @strSQL = @strSQL + N'it.Description'

SET @strSQL = @strSQL + N' AS Industry,
uot.Description AS Ownership, arct.Description AS ReportClassDescription, u.Name AS UtilityName,
ua.AttnName, ua.AddrLine1, ua.AddrLine2, ua.City,
usp.Name AS State, ua.PostalCode, ua.Phone, uc.Name AS Country
FROM UtilityIndustry ui
INNER JOIN IndustryTypes it ON ui.IndustryType = it.TypeID
INNER JOIN Utility u ON ui.UtilityID = u.UtilityID
INNER JOIN UtilityOwnershipTypes uot ON u.OwnershipType = uot.TypeID

INNER JOIN UtilityAddress ua ON ui.IndustryID = ua.UtilityIndustryID and ua.AddressType = 1
INNER JOIN URCStateProvince usp ON ua.StateID = usp.StateID
INNER JOIN URCCountry uc ON ua.CountryID = uc.CountryID

inner join
(
select u3.utilityid, sit3.description as [description], rst3.description as [status]
from utility u3
inner join utilityindustry i3 on u3.utilityid=i3.utilityid
inner join utilitysubindustry si3 on i3.industryid=si3.industryid
inner join utilityregstatus rs3 on si3.subindustryid=rs3.subindustryid
inner join regulatorystatustypes rst3 on rs3.statustype=rst3.typeid
left outer join subindustrytypes sit3 on si3.subindustrytype=sit3.typeid
where rs3.dateeffective=(select max(dateeffective) from utilityregstatus where subindustryid=rs3.subindustryid)
) as sit on u.utilityid=sit.utilityid

LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
LEFT OUTER JOIN AnnualReport ar ON ui.IndustryID = ar.UtilityIndustryID AND ly.LastYearOnFile = ar.Year
LEFT OUTER JOIN AnnualReportClassTypes arct ON ar.ReportClass = arct.TypeID
WHERE '

-- If industry = 0 then water/sewer
IF @IndustryID = 0
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct ui.utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
LEFT OUTER JOIN AnnualReport ar ON ui.IndustryID = ar.UtilityIndustryID AND ly.LastYearOnFile = ar.Year
WHERE industryType = 3' + @industryCriteria + ') AND ui.UtilityID in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ')'
END
ELSE IF @IndustryID = 3
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 3' + @industryCriteria + ') AND ui.UtilityID not in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ')'
END
ELSE IF @IndustryID = 4
BEGIN
SET @strSQL = @strSQL + 'ui.UtilityID in (select distinct ui.utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 4' + @industryCriteria + ') AND ui.UtilityID not in
(select distinct utilityID from utilityIndustry ui
LEFT OUTER JOIN UtilitySubIndustryview usi ON ui.industryID = usi.industryID
LEFT OUTER JOIN (SELECT UtilityIndustryID, max(year) as LastYearOnFile
FROM AnnualReport GROUP BY UtilityIndustryID) ly ON ui.IndustryID = ly.UtilityIndustryID
WHERE industryType = 3' + @industryCriteria + ')'
END
ELSE
BEGIN
SET @strSQL = @strSQL + 'ui.IndustryType = ' + CAST(@IndustryID AS NVARCHAR(15)) + @industryCriteria
END

IF @FeeBilledOnly = 1
BEGIN
SET @strSQL = @strSQL + ' AND u.feeBill = ''YES'''
END

If @Category = 1
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'', ''CLEC-R'')'
END

If @Category = 2
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'')'
END

If @Category = 3
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-R'')'
END

If @Category = 4
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''AOS'')'
END

If @Category = 5
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CAP'')'
END

If @Category = 7
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''WIRELESS'')'
END

If @Category = 9
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-F'', ''AOS'', ''CAP'', ''IXC'', ''WIRELESS'')'
END

If @Category = 10
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''ILEC'')'
END

If @Category = 11
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''IXC'')'
END

If @Category = 12
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''ILEC'', ''CLEC-R'', ''CLEC-F'')'
END

If @Category = 13
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description IN (''CLEC-R'', ''TOLLRESELLER'')'
END

IF @Category = 14
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description = ''TOLLRESELLER'''
END

IF @Category = 16
BEGIN
SET @strSQL = @strSQL + ' AND sit.Description = ''REMC'''
END

SET @orderBy = ' ORDER BY'
SET @orderByCount = 0

IF @SortBy1 = 'c'
BEGIN
SET @orderBy = @orderBy + ' arct.Description'
END
ELSE IF @SortBy1 = 'n'
BEGIN
SET @orderBy = @orderBy + ' u.Name'
END
ELSE IF @SortBy1 = 'o'
BEGIN
SET @orderBy = @orderBy + ' uot.Description'
END

IF @SortBy2 = 'c'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' arct.Description'
END
ELSE IF @SortBy2 = 'n'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' u.Name'
END
ELSE IF @SortBy2 = 'o'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' uot.Description'
END

IF @SortBy3 = 'c'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' arct.Description'
END
ELSE IF @SortBy3 = 'n'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' u.Name'
END
ELSE IF @SortBy3 = 'o'
BEGIN
SET @orderByCount = @orderByCount + 1
IF @orderByCount > 0
SET @orderBy = @orderBy + ', '
SET @orderBy = @orderBy + ' uot.Description'
END

IF @orderByCount > 0
SET @strSQL = @strSQL + @orderBy

EXECUTE(@strSQL)

RETURN @@ERROR





quote:
Originally posted by X002548

So where's the execute?

Do a PRINT of @strSQ and see what was created...post that here

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/




Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-02-29 : 15:17:01
Right

COMMENT out

--EXECUTE(@strSQL)


And Add


PRINT @strSQL


And get rid of

RETURN @@ERROR

Just do RETURN and use an output variable to store a return code or whatever






Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-29 : 16:06:20
Unless we see your PRINT(@SQL) result we cant suggest anything as we dont know what query its building up

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -