Click here to Skip to main content
15,904,653 members

Comments by Murali Vijay (Top 19 by date)

Murali Vijay 17-Jun-14 3:23am View    
select prid,new_roi=case when isroi='y' then 'y' when isroi='N' then 'y' else '' end from table_name;
Murali Vijay 16-Jun-14 3:28am View    
try this

declare @Company_Code int=5

with CTE
AS( SELECT distinct @Company_Code,
'bc'+ cast(row_number()over(order by customerID asc) as nvarchar(100))as BillCode,
isnull(AddressLine1,'') as AddressLine1,
isnull(AddressLine2,'') as AddressLine1,
isnull(City_Suburb,'') as City_Suburb,
isnull(StateAbbreviation,'') as StateAbbreviation,
Zip_Postcode,
CC.Country_Code,
Phone ,
Phone as phone_ext,
Email,
'' as Fax,
GETDATE() as create_date_time,
'SYSTEM' as create_user_id,
GETDATE() as last_update_date_time,
'SYSTEM' as last_update_user_id

from MTrackDataImport..rawCustomerSISU C

LEFT OUTER JOIN CD_country CC
ON (CC.Company_Code = @Company_Code
AND C.Country = CC.Country_Name))

select BillCode,StateAbbreviation from cte
Murali Vijay 16-Jun-14 3:26am View    
Deleted
try this

declare @Company_Code int=5

with CTE
AS( SELECT distinct @Company_Code,
'bc'+ cast(row_number()over(order by customerID asc) as nvarchar(100))as BillCode,
isnull(AddressLine1,'') as AddressLine1,
isnull(AddressLine2,'') as AddressLine1,
isnull(City_Suburb,'') as City_Suburb,
isnull(StateAbbreviation,'') as StateAbbreviation,
Zip_Postcode,
CC.Country_Code,
Phone ,
Phone as phone_ext,
Email,
'' as Fax,
GETDATE() as create_date_time,
'SYSTEM' as create_user_id,
GETDATE() as last_update_date_time,
'SYSTEM' as last_update_user_id

from MTrackDataImport..rawCustomerSISU C

LEFT OUTER JOIN CD_country CC
ON (CC.Company_Code = @Company_Code
AND C.Country = CC.Country_Name))

select BillCode,StateAbbreviation from cte order by BillCode desc
Murali Vijay 16-Jun-14 3:14am View    
everything works fine what you have tried in my local also.Go and check whether identity is set or not for column id in your database
Murali Vijay 16-Jun-14 3:06am View    
post the code you have tried