ÇóSql Óï¾äµÄд·¨ - MS-SQL Server / ÒÉÄÑÎÊÌâ
±íÃû : tb1
×Ö¶ÎÃû³Æ: ID a
×Ö¶ÎÖµ : 1 10667766*X06*KYG08B01L18XU01*V4_10667766*X06*KYG08B01L18XU01*V4
2 10667766*X06*KYG01TSTSHELU01_10667766*A53*KYG01TSTSHELU01_10667766*X06*KYG01TSTSHELU01*V4
3 10668001*2KY*KYM01B01L18XU01*V4
4 1062376664*4*KYG08B01L18XU01*V4_1062376664*4*KYG08B01L18XU01*V4
Ôõô°ÑÉϱí±ä³ÉÈçÏÂËùʾ:
ID a1 a2 a3
1 10667766*X06*KYG08B01L18XU01*V4 10667766*X06*KYG08B01L18XU01*V4
2 10667766*X06*KYG01TSTSHELU01 10667766*A53*KYG01TSTSHELU01 10667766*X06*KYG01TSTSHELU01*V4
3 10668001*2KY*KYM01B01L18XU01*V4
4 1062376664*4*KYG08B01L18XU01 KYG08B01L18XU01*V4 1062376664*4*KYG08B01L18XU01*V4
Don't understand the logic. You need to provide more information as to how you arrive from the original table to the output you provided.
SQL code:
££¶¯Ì¬SQL£º
--> Éú³É²âÊÔÊý¾Ý±í: [tb]
IF OBJECT_ID('[tb]') IS NOT NULL
DROP TABLE [tb]
GO
CREATE TABLE [tb] ([ID] [int],[a] [nvarchar](90))
INSERT INTO [tb]
SELECT '1','10667766*X06*KYG08B01L18XU01*V4_10667766*X06*KYG08B01L18XU01*V4' UNION ALL
SELECT '2','10667766*X06*KYG01TSTSHELU01_10667766*A53*KYG01TSTSHELU01_10667766*X06*KYG01TSTSHELU01*V4' UNION ALL
SELECT '3','10668
Ïà¹ØÎÊ´ð£º
ÎÒÒ»¸öÏîÄ¿£¬Óиö²åÈë²Ù×÷£¬¾ßÌåÊÇÕâÑùµÄ£º
ÎÒÓнø»õÐÅÏ¢±í¡£ÔÚ³ö»õʱѡÔñÏàÓ¦µÄ½ø»õÐÅÏ¢£¬ÊäÈëÊýÁ¿£¬Ñ¡Ôñ²¿Ãź󣬵㱣´æ°´Å¥£¬ÓÉÓÚÍøÂçÑÓʱ£¬µãÒ»ÏÂûÓз´Ó³£¬ÓÚÊÇÓû§¾ÍÓÖµãһϣ¬µ¼ÖÂÒ»´Î²åÈëÁËÁ½Ìõ¼Ç¼:
Àý£º
......
ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄÇ°2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ã棬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
½«Ò»¸ö²éѯÓï¾ä¸³¸øÒ»¸ö±äÁ¿£¬ÈçÏ£º
DECLARE @STR NVARCHAR(MAX)
SET @STR='SELECT * from SALE_PROD'
ÔõôÑù²ÅÄÜÖ´ÐÐËüÄØ£¿
Çë¸ßÊÖ£¬ÈÊÐÖ£¬ÏÀ½ã°ï°ïæ°¡
¶àл£¬¿ÉÒÔÀ²£¬¸ßÊÖ°¡
Ö±½ÓÖ´ÐоÍÐÐÁË
exec ......