Click here to Skip to main content
15,884,298 members
Home / Discussions / Database
   

Database

 
GeneralRe: DTS Stopped working after motherboard change Pin
FrankLepkowski10-Jul-08 8:54
FrankLepkowski10-Jul-08 8:54 
GeneralRe: DTS Stopped working after motherboard change Pin
DerekFL10-Jul-08 9:30
DerekFL10-Jul-08 9:30 
GeneralRe: DTS Stopped working after motherboard change Pin
DerekFL10-Jul-08 9:35
DerekFL10-Jul-08 9:35 
QuestionSelecting from three tables? Pin
NewToAspDotNet10-Jul-08 4:55
NewToAspDotNet10-Jul-08 4:55 
AnswerRe: Selecting from three tables? Pin
leoinfo10-Jul-08 5:05
leoinfo10-Jul-08 5:05 
QuestionExport from Visio to Mysql or From MS Sql Server to mysql Pin
Mohammad Al Hoss10-Jul-08 4:28
Mohammad Al Hoss10-Jul-08 4:28 
QuestionParse values in SQL SP Pin
sqldba10-Jul-08 3:21
sqldba10-Jul-08 3:21 
AnswerRe: Parse values in SQL SP [modified] Pin
leoinfo10-Jul-08 7:18
leoinfo10-Jul-08 7:18 
See below...

DECLARE @s NVARCHAR(4000);
SET @s = '(SVDB, N, Y; VGBY, Y, B; SCFV, Y, S; SRVD, Y, N; SRVD, Y, N; )';

/* START PROCESSING */;
SET @s = REPLACE(REPLACE(REPLACE( @s ,' ','') ,'(','') ,')','');

CREATE TABLE #S (pk INT IDENTITY(1,1), line NVARCHAR(100)); 
CREATE TABLE #T (col1 NVARCHAR(4), col2 NVARCHAR(1), col3 NVARCHAR(1)); 

DECLARE @p1 INT;
DECLARE @p2 INT;
SET @p1 = 1; 
SET @p2 = CHARINDEX(';' , @s); 

WHILE @p1 < @p2 
BEGIN 
	INSERT INTO #S (line) SELECT SUBSTRING(@s, @p1, @p2-@p1); 
	SET @s = SUBSTRING(@s, @p2+1, LEN(@s)); 
	SET @p1 = 1; 
	SET @p2 = CHARINDEX(';' , @s); 
END 

DECLARE @k INT;SET @k = 1; 
DECLARE @max INT; 
SELECT @max = MAX(pk) FROM #S; 


WHILE @k < @max 
BEGIN 
	SELECT @s = 
          'INSERT INTO #T (col1 , col2 , col3) SELECT  ''' 
          + REPLACE( line , ',', ''',''') + '''' FROM #S WHERE pk = @k; 
	EXEC(@s); 
	SET @k = @k + 1; 
END 

DROP TABLE #S; 

SELECT * FROM #T; 

/* ;
...... 
Do what ever you have to do with data in #T table 
..... 
*/ ;

DROP TABLE #T; 
/* END PROCESSING */


Tell me please if this works.

Good luck! Smile | :)

modified on Thursday, July 10, 2008 1:38 PM

QuestionPattern matching to list in sql Pin
Member 469462710-Jul-08 2:21
Member 469462710-Jul-08 2:21 
QuestionRe: Pattern matching to list in sql Pin
TheFM23410-Jul-08 4:49
TheFM23410-Jul-08 4:49 
QuestionOPENXML() and performance Pin
Kjetil Svendsen9-Jul-08 22:29
Kjetil Svendsen9-Jul-08 22:29 
AnswerRe: OPENXML() and performance Pin
Ashfield10-Jul-08 1:41
Ashfield10-Jul-08 1:41 
GeneralRe: OPENXML() and performance Pin
Kjetil Svendsen10-Jul-08 2:34
Kjetil Svendsen10-Jul-08 2:34 
QuestionInternal Processor Error Pin
mehrnoosh9-Jul-08 21:58
mehrnoosh9-Jul-08 21:58 
AnswerRe: Internal Processor Error Pin
John_Adams10-Jul-08 1:34
John_Adams10-Jul-08 1:34 
GeneralRe: Internal Processor Error Pin
mehrnoosh14-Jul-08 22:17
mehrnoosh14-Jul-08 22:17 
QuestionConvert Decimal into Date Query?? Pin
obarahmeh9-Jul-08 20:30
obarahmeh9-Jul-08 20:30 
AnswerRe: Convert Decimal into Date Query?? Pin
Paddy Boyd9-Jul-08 20:56
Paddy Boyd9-Jul-08 20:56 
AnswerRe: Convert Decimal into Date Query?? Pin
Ashfield9-Jul-08 21:07
Ashfield9-Jul-08 21:07 
GeneralRe: Convert Decimal into Date Query?? Pin
obarahmeh9-Jul-08 22:35
obarahmeh9-Jul-08 22:35 
GeneralRe: Convert Decimal into Date Query?? [modified] Pin
Ashfield10-Jul-08 1:27
Ashfield10-Jul-08 1:27 
GeneralRe: Convert Decimal into Date Query?? Pin
obarahmeh10-Jul-08 2:02
obarahmeh10-Jul-08 2:02 
GeneralRe: Convert Decimal into Date Query?? Pin
Ashfield10-Jul-08 9:22
Ashfield10-Jul-08 9:22 
AnswerRe: Convert Decimal into Date Query?? [modified] Pin
leoinfo10-Jul-08 2:44
leoinfo10-Jul-08 2:44 
GeneralRe: Convert Decimal into Date Query?? [modified] Pin
obarahmeh12-Jul-08 21:46
obarahmeh12-Jul-08 21:46 

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.