Welcome to Sign in | Help

select gresit....dar unde?

  •  09-12-2007, 12:32 PM

    select gresit....dar unde?

    salut am si eu selectul de mai jos care il execut astfel........unde e eroarea ca nu-mi dau seama....

    exec sp_executesql N'select distinct
    mp.Nume as ModalitatePlata,
    cv.new_contractvanzariid,
    cv.new_tipcontractidid,
    cv.new_accountid,
    cv.new_tipfazacontractidid,
    isnull(cv.new_numarinregistrareextern,0)new_numarinregistrareextern,
    isnull(convert(varchar(10),cv.new_numarinregistrareexterndata,102),''0/ 0/ 0'') new_numarinregistrareexterndata,
    isnull(cv.new_functieutilizator,'' - '') new_functieutilizator,
    isnull(cv.new_numarcontract,0) new_numarcontract,
    isnull(convert(varchar(10),
    cv.new_dataincheierecontract,102),''0/ 0/ 0'') new_dataincheierecontract,
    isnull(cv.owneridname,'' - '') owneridname,
    isnull(cv.New_AccountIdName,'' - '') New_AccountIdName,
    v.VersiuneContractID,
    v.New_MonedaID_TVAPretTotal,
    v.New_MonedaID_Avans,isnull(v.PretTotal,0) PretTotal,
    isnull(v.TVAPretTotal,0) TVAPretTotal,
    isnull(v.FurnizareProduseZile,0) FurnizareProduseZile,
    isnull(v.AdresaDeLivrare,''-'') AdresaDeLivrare,
    isnull(v.GarantieAni,0) GarantieAni,
    isnull(v.GarantieLuni,0) GarantieLuni,
    isnull(v.GarantieZile,0) GarantieZile,
    isnull(v.Avans,0) Avans,
    isnull(v.PerioadaAvans,0) PerioadaAvans,
    isnull(v.DiferentaDePlata,0) DiferentaDePlata,
    isnull(v.PerioadaDiferentaDePlata,0) PerioadaDiferentaDePlata,
    isnull(v.PenalitatiIntarziereLivrare,0) PenalitatiIntarziereLivrare,
    isnull(v.PenalitatiIntarzierePlata,0) PenalitatiIntarzierePlata, isnull(v.PerioadaFortaMajora,''0 zile'') PerioadaFortaMajora, isnull(v.ReprezentantClient,'' - '') ReprezentantClient,
    isnull(v.FunctieReprezentantClient,'' - '') FunctieReprezentantClient, v.ModalitatePlataID, v.EUltimaVersiune, isnull(v.NumarVersiune,0) NumarVersiune,
    v.DocA, v.DocB, v.DocC, v.DocD, v.DocE, v.DocF, v.DocG, v.DocH, v.DocAltele, isnull(v.DocAlteleDenumire,''  '') DocAlteleDenumire,
    isnull(v.NrContract,'' - '') NrContract, v.New_MonedaID, v.AccountID, v.New_TipFazaContractID, v.OwnerID, v.OwningBusinessUnit,
    isnull(v.New_Valoare,0) New_Valoare, isnull(v.New_ValoareTVA,0) New_ValoareTVA, isnull(v.New_NrInregExtern,0) New_NrInregExtern, isnull(convert(varchar(10),v.New_NrInregExtern_Data,102),''0/ 0/ 0'') New_NrInregExtern_Data,isnull(v.New_FunctieUser,''-'') New_FunctieUser,
    v.New_name, convert(varchar(10),v.New_DataContract,102) DataContract, isnull(convert(varchar(10),v.New_DataIncheieriiContract,102),''0/ 0/ 0'') DataIncheieriiContract, su.fullName, su1.Title,
    isnull(bu.address1_telephone1,'' - '') address1_telephone1,isnull(bu.address1_line1,'' - '') address1_line1,isnull(bu.address1_city,'' - '') as oras,
    ISNULL(bu.address1_fax,'' - '') address1_fax, isnull(bu.FtpSiteUrl,'' - '') FtpSiteUrl, isnull(bu.EMailAddress,'' - '')EMailAddress ,
    isnull(comp.Sucursala,'' - '') Sucursala, isnull(comp.Sediu,'' - '') Sediu,isnull(comp.CodFiscalCUI,'' - '') CodFiscalCUI, isnull(comp.NumarInregistrareJ,'' - '') NumarInregistrareJ,
    isnull(comp.Cont,'' - '') Cont, isnull(comp.Banca,'' - '') Banca, isnull(comp.Reprezentant,'' - '') Reprezentant,isnull(comp.FunctieReprezentant,'' - '') FunctieReprezentant,isnull(comp.nume,'' - '') nume,
    acc.PrimaryContactId, isnull(acc.Name,'' - '') as NumeBeneficiar, isnull(acc.Address1_city,'' - '') Address1_city,
    isnull(acc.Address1_line1,'' - '') acc_adresa, isnull(acc.New_codfiscal,'' - '') New_codfiscal,isnull(acc.new_numarInregistrarej,'' - '') new_numarInregistrarej,
    isnull(acc.new_contIBAN,'' - '') new_contIBAN, isnull(acc.new_Banca,'' - '') new_Banca, isnull(acc.new_Sucursala,'' - '') new_Sucursala,isnull(acc.new_judet_sector,'' - '') new_judet_sector,
    isnull(contact.Fullname,'' - '') as contact_nume, isnull(contact.Jobtitle,'' - '') Jobtitle
    from New_ContractVanzari cv
    left join Contracte..Contract c on cv.New_ContractVanzariId = c.New_ContractVanzariId
    left join Contracte..VersiuneContract v on c.ContractId = v.ContractId and v.EUltimaVersiune = 1
    left Join SystemUser su On su.BusinessUnitId=cv.OwningBusinessUnit and (su.Title=''Director Filiala'' or su.Title=''Director Vanzari'')
    left join SystemUser su1 On cv.OwnerId=su1.SystemUserId
    left join BusinessUnit bu on bu.BusinessUnitID=cv.OwningBusinessUnit
    left join Contracte..Companie comp on comp.CompanieId=c.CompanieID 
    left join Contracte..ModalitatePlata mp on mp.ModalitatePlataID=v.ModalitatePlataID
    left join Account acc on acc.AccountId=cv.new_AccountId
    left join Contact contact on contact.ContactId=acc.PrimaryContactID
    where cv.New_ContractVanzariId= @Contract', N'@Contract nvarchar(4000)', @Contract = N'474772a2-0056-dc11-baea-0003ff6523e6'

    si primesc eroarea

     

    Server: Msg 8169, Level 16, State 2, Line 1
    Syntax error converting from a character string to uniqueidentifier.

     

    multumesc mult.

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems