Click here to Skip to main content
15,895,799 members
Home / Discussions / Database
   

Database

 
AnswerRe: split datatable column using c# Pin
Jaimin H. Soni6-Aug-14 1:12
Jaimin H. Soni6-Aug-14 1:12 
GeneralRe: split datatable column using c# Pin
Eddy Vluggen6-Aug-14 1:56
professionalEddy Vluggen6-Aug-14 1:56 
GeneralRe: split datatable column using c# Pin
Jaimin H. Soni6-Aug-14 2:00
Jaimin H. Soni6-Aug-14 2:00 
GeneralRe: split datatable column using c# Pin
Eddy Vluggen6-Aug-14 2:30
professionalEddy Vluggen6-Aug-14 2:30 
QuestionHelp with XML Pin
byka31-Jul-14 6:36
byka31-Jul-14 6:36 
GeneralRe: Help with XML Pin
PIEBALDconsult31-Jul-14 7:01
mvePIEBALDconsult31-Jul-14 7:01 
GeneralRe: Help with XML Pin
byka31-Jul-14 7:04
byka31-Jul-14 7:04 
AnswerRe: Help with XML Pin
Richard Deeming31-Jul-14 7:29
mveRichard Deeming31-Jul-14 7:29 
Your OPENXML query doesn't work because the node value contains white-space, which is not getting trimmed. Since you're only taking the first 5 characters, you'll get a string containing nothing by white-space.

Your .nodes() query doesn't work because you're getting the PolicyType nodes, and then trying to find the third PolicyType node within that node.

Try this:
SQL
DECLARE @xmlPolicyType XML
SET @xmlPolicyType= REPLACE('<?xml version="1.0" encoding="utf-16"?>
<NewDataSet>
<PolicyType>
     MED  
</PolicyType>
<PolicyType>
     SPORT
</PolicyType>
</NewDataSet>
','utf-16','UTF-8');

DECLARE @PolicyTypes TABLE 
( 
    PolicyType char(5) 
);

INSERT INTO @PolicyTypes
(
    PolicyType
)
SELECT
    LTrim(Replace(Replace(Replace(
        T.PolicyType.value('.', 'varchar(120)')
    , Char(13), ''), Char(10), ''), Char(9), ''))
FROM
    @xmlPolicyType.nodes('/NewDataSet/PolicyType') As T (PolicyType)
;




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionCannot create a foreign key reference (probably my fault) Pin
Richard MacCutchan31-Jul-14 0:38
mveRichard MacCutchan31-Jul-14 0:38 
AnswerRe: Cannot create a foreign key reference (probably my fault) Pin
Simon_Whale31-Jul-14 1:27
Simon_Whale31-Jul-14 1:27 
GeneralRe: Cannot create a foreign key reference (probably my fault) Pin
Richard MacCutchan31-Jul-14 1:36
mveRichard MacCutchan31-Jul-14 1:36 
AnswerRe: Cannot create a foreign key reference (probably my fault) Pin
Eddy Vluggen31-Jul-14 1:28
professionalEddy Vluggen31-Jul-14 1:28 
GeneralRe: Cannot create a foreign key reference (probably my fault) Pin
Richard MacCutchan31-Jul-14 1:39
mveRichard MacCutchan31-Jul-14 1:39 
GeneralRe: Cannot create a foreign key reference (probably my fault) Pin
Eddy Vluggen31-Jul-14 11:08
professionalEddy Vluggen31-Jul-14 11:08 
QuestionInsert into temptable ( #tmp1 ) that execute result from 1 procedure ( return 2 results ) Pin
LTMKH30-Jul-14 22:30
LTMKH30-Jul-14 22:30 
AnswerRe: Insert into temptable ( #tmp1 ) that execute result from 1 procedure ( return 2 results ) Pin
Mycroft Holmes30-Jul-14 22:51
professionalMycroft Holmes30-Jul-14 22:51 
GeneralRe: Insert into temptable ( #tmp1 ) that execute result from 1 procedure ( return 2 results ) Pin
LTMKH31-Jul-14 15:53
LTMKH31-Jul-14 15:53 
GeneralRe: Insert into temptable ( #tmp1 ) that execute result from 1 procedure ( return 2 results ) Pin
Mycroft Holmes31-Jul-14 16:15
professionalMycroft Holmes31-Jul-14 16:15 
QuestionHow to Calculate Total Time Difference Pin
Robymon28-Jul-14 3:06
Robymon28-Jul-14 3:06 
AnswerRe: How to Calculate Total Time Difference Pin
Corporal Agarn28-Jul-14 3:26
professionalCorporal Agarn28-Jul-14 3:26 
GeneralRe: How to Calculate Total Time Difference Pin
Robymon28-Jul-14 3:36
Robymon28-Jul-14 3:36 
GeneralRe: How to Calculate Total Time Difference Pin
Corporal Agarn28-Jul-14 3:39
professionalCorporal Agarn28-Jul-14 3:39 
AnswerRe: How to Calculate Total Time Difference Pin
David Mujica28-Jul-14 3:28
David Mujica28-Jul-14 3:28 
AnswerRe: How to Calculate Total Time Difference Pin
Andrius Leonavicius28-Jul-14 11:32
professionalAndrius Leonavicius28-Jul-14 11:32 
GeneralRe: How to Calculate Total Time Difference Pin
Mycroft Holmes29-Jul-14 13:05
professionalMycroft Holmes29-Jul-14 13:05 

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.