hi
i have following values in my table "sharefile"
FilePath Users CompanyId
1043_CAB1\111.txt 2083 1043
1043_CabFW\111.txt 2083 1043
1040_Admin\Admin.docx 2089 1040
I need to select all rows same like above,but need to remove companyid with "_" in select query
my need is
FilePath Users CompanyId
CAB1\111.txt 2083 1043
CabFW\111.txt 2083 1043
Admin\Admin.docx 2089 1040
I am try with replace function in select query,i can remove only Companyid form filepath,still need to remove "_" underscore also
This is query i tried
SELECT replace (FilePath,CompanyId ,'') as FilePath , Users, CompanyId FROM ShareFile
and result is
_CAB1\111.txt 2083 1043
_CabFW\111.txt 2083 1043
_Admin\Admin.docx 2089 1040
I am try to add "_" in replace function like this,but cant add,bcz of comapnyid datatype is int.Only in string datatype can add "_"
SELECT replace (FilePath,CompanyId & N'_' ,'') as FilePath , Users, CompanyId FROM ShareFile
Or if possible in sql select query can remove letters upto first "_" using substring function
Pls reply me how to achieve this
Regards
Araindb