Quantcast
Channel: not a valid identifier
Viewing all articles
Browse latest Browse all 11

not a valid identifier

$
0
0

 

Hi,

 

I'm trying to write a store proc like this;

 

Code Snippet

CREATE

 procedure [SummaryTest6]

/*

BEGIN LOOP

*/

AS

declare

@worksheetname varchar(100)

declare

@SQL_Port ASvarchar(1000)

declare

@SQL_Loss ASvarchar(1000)

declare

@SQL varchar(3000)

declare

rREF cursorlocalfor

select

p.worksheetname, p.SQL as SQL_Port,

l

.SQL as SQL_Loss

from

adhoc.dbo.tempSQL p

join

adhoc.dbo.tempSQL l

on

p.worksheetname=l.worksheetname

where

p.report='Port'and l.report='Loss'

order

by p.ordercompletion

open

rREF

fetch

nextfrom rREF into @worksheetname, @SQL_Port, @SQL_Loss

while

@@fetch_status=0

Begin

SET

@SQL='

DECLARE @ReportMonth AS SMALLDATETIME, @FirstOfYear AS SMALLDATETIME

SET @ReportMonth = [ADHOC].[ad-ent\knratna].[DateRoutine](GETDATE(), ''1'' )

SET @FirstofYear = [ADHOC].[ad-ent\knratna].[DateRoutine](GETDATE(), ''5'' )

INSERT INTO [ADHOC].[ad-ent\knratna].[CO_HomeEquity]

select '''

+ @worksheetname +'''

,p.FileMonth

,sum (AcctCurrentBal)/1000 as Bal

 

from SRM.dbo.tblPortfolio p

left join SRM.dbo.tblFunded f

on p.CurrentApp = f.AppNumber

where p.FileMonth >= @FirstofYear

and p.FileMonth <= @ReportMonth

 '

+ @SQL_Port+'

Group by p.FileMonth'

 

print

@SQL

print

'/**************************************************************/'

 

EXEC @SQL

FETCH

NEXTFROM rREF INTO @worksheetname, @SQL_Port, @SQL_Loss

END

DEALLOCATE

rREF

 

 

when i run this store proc, i get the following error message.

 

Msg 203, Level 16, State 2, Procedure ks_CO_SummaryTest6, Line 123

The name '

DECLARE @ReportMonth AS SMALLDATETIME, @FirstOfYear AS SMALLDATETIME

SET @ReportMonth = [ADHOC].[ad-ent\knratna].[DateRoutine](GETDATE(), '1' )

SET @FirstofYear = [ADHOC].[ad-ent\knratna].[DateRoutine](GETDATE(), '5' )

INSERT INTO [ADHOC].[ad-ent\knratna].[CO_HomeEquity]

select 'HEQData'

,p.FileMonth

,sum (AcctCurrentBal)/1000 as Bal

,avg(cast(AgeMonths as float)) as Age

'is not a valid identifier.

 

tempSQL table is as follows;

wokrsheetname                                   SQL

HEQData             2                                                                                                           Port
HEQData            3                                                                                                           Loss
HEQDataX           4       '' and ((p.LineOfBusiness = ''InstLend'' and  f.ExceptionFlag = ''Y'''       Port
HEQDataX           5       '' and ((au.LineOfBusiness = ''InstLend'' and f.ExceptionFlag = ''Y'''      Loss

Can anyone tell me how to fix this error?

 

Thanks

Viewing all articles
Browse latest Browse all 11

Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Love Quotes Tagalog


Dino Rey para colorear


Libros para colorear


Mandalas de flores para colorear


Dibujos para colorear de perros


Dromedario para colorear


Gwapo Quotes : Babaero Quotes


“Top 10 Love Quotes Version 2.0”


RE: Mutton Pies (mely)


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Long Distance Relationship Tagalog Love Quotes


Winx Club para colorear


Girasoles para colorear


Sapos para colorear


Renos para colorear


Pulga para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Pangarap Quotes


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal





Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC