Click here to Skip to main content
15,886,851 members
Home / Discussions / Database
   

Database

 
AnswerRe: Storing images, documents etc in a database Pin
Henry Minute17-Dec-10 13:51
Henry Minute17-Dec-10 13:51 
QuestionSSIS package converting varchar(MAX) to nvarchar(50) Pin
raghvendrapanda15-Dec-10 22:36
raghvendrapanda15-Dec-10 22:36 
Question\r\n ignored when executing queryies using ADO Pin
Fayu14-Dec-10 13:01
Fayu14-Dec-10 13:01 
QuestionRe: \r\n ignored when executing queryies using ADO Pin
Chris Meech15-Dec-10 3:04
Chris Meech15-Dec-10 3:04 
AnswerRe: \r\n ignored when executing queryies using ADO Pin
Fayu17-Dec-10 5:23
Fayu17-Dec-10 5:23 
GeneralRe: \r\n ignored when executing queryies using ADO Pin
Chris Meech17-Dec-10 9:39
Chris Meech17-Dec-10 9:39 
GeneralRe: \r\n ignored when executing queryies using ADO Pin
Fayu17-Dec-10 15:26
Fayu17-Dec-10 15:26 
QuestionReplace with integer (1,2,3...) Problem in SQL Query [modified] Pin
Varun Sareen14-Dec-10 0:40
Varun Sareen14-Dec-10 0:40 
Dear Friends,

I have a query in which there is a sub query that is fetching a no of rows (single column); it may be one,two..upto six (not more than that). It is using for xml path( '' ) feature of SQL server in order to display the values as comma separated values.

The query is as follows:-


SQL
select distinct (select top 1 CLAIMMASTERID from ClaimMaster where encounterid='87B6D11C-3680-44A5-B1DB-AB16B3907AA6') ,EVC.EncounterID,EVC.CPT,(select (select ICDCode + ',' as [text()] from VisitTypeICDCPT soi where soi.VisitTypeID = t.VisitTypeID and VisitTypeID=VTI.VisitTypeID and encounterid='87B6D11C-3680-44A5-B1DB-AB16B3907AA6' order by VisitTypeID for xml path( '' )) from (select distinct VisitTypeID from VisitTypeICDCPT where VisitTypeID=VTI.VisitTypeID and encounterid='87B6D11C-3680-44A5-B1DB-AB16B3907AA6') as t )DiagnosisCode,EVC.Fee,convert(varchar(10),'2010-12-14 00:00:00.000',101) from EncounterVisitCode EVC inner join VisitTypeICDCPT VTI on EVC.encounterid=VTI.encounterid where EVC.encounterid='87B6D11C-3680-44A5-B1DB-AB16B3907AA6'


Here the sub query(starting from :-(select (select ICDCode...)) which is fetching the data from the database and the where "Diagnosis Code" is the column name. The data query is fetching is like this:- 004.12,001.20,...upto six values (may be less).

Here i want the values to be replaced by integer values depending upon the no of values being fetched by sub-query i.e., 1,2, if values in no. are two, 1,2,3, if values in no. are three and so on...

I am not able to find any way out to solve this problem. If someone could help me resolve this problem i would be very grateful to him/her.

Thanks

Varun Sareen
modified on Friday, December 17, 2010 6:53 AM

AnswerRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Hiren solanki14-Dec-10 0:57
Hiren solanki14-Dec-10 0:57 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Corporal Agarn14-Dec-10 3:26
professionalCorporal Agarn14-Dec-10 3:26 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Jörgen Andersson14-Dec-10 10:04
professionalJörgen Andersson14-Dec-10 10:04 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Varun Sareen16-Dec-10 0:32
Varun Sareen16-Dec-10 0:32 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Hiren solanki16-Dec-10 1:54
Hiren solanki16-Dec-10 1:54 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Varun Sareen17-Dec-10 0:56
Varun Sareen17-Dec-10 0:56 
AnswerRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Hiren solanki17-Dec-10 1:16
Hiren solanki17-Dec-10 1:16 
GeneralRe: Replace with integer (1,2,3...) Problem in SQL Query Pin
Corporal Agarn17-Dec-10 3:38
professionalCorporal Agarn17-Dec-10 3:38 
QuestionPMT function IN ORACLE OR SQL Pin
ShaktisinhRathod13-Dec-10 23:05
ShaktisinhRathod13-Dec-10 23:05 
AnswerRe: PMT function IN ORACLE OR SQL Pin
Hiren solanki13-Dec-10 23:23
Hiren solanki13-Dec-10 23:23 
QuestionThe permissions granted to user 'domain\user' are insufficient for performing this operation. (rsAccessDenied) Pin
vinu.111112-Dec-10 23:44
vinu.111112-Dec-10 23:44 
QuestionMerge Replication Conflict Pin
Abdul Rahman Hamidy12-Dec-10 22:12
Abdul Rahman Hamidy12-Dec-10 22:12 
Questionread & update using reader Pin
Jassim Rahma12-Dec-10 3:00
Jassim Rahma12-Dec-10 3:00 
AnswerRe: read & update using reader Pin
RaviRanjanKr12-Dec-10 3:26
professionalRaviRanjanKr12-Dec-10 3:26 
GeneralRe: read & update using reader Pin
Not Active12-Dec-10 3:50
mentorNot Active12-Dec-10 3:50 
GeneralRe: read & update using reader Pin
RaviRanjanKr12-Dec-10 4:04
professionalRaviRanjanKr12-Dec-10 4:04 
GeneralRe: read & update using reader Pin
Not Active12-Dec-10 5:13
mentorNot Active12-Dec-10 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.