sqlÖÐÖÐÎÄÁÐÃû
½ñÌìÓöµ½Ò»¸öÎÊÌ⣺
ÔÚÆ´Ò»Ìõ¶¯Ì¬SqlÓï¾äʱ£¬ÓÉÓÚÊÇÓÃ×ֶεÄÖµ×öÁÐÃû£¬ËùÒÔÁÐÃûÓõ½Á˺º×Ö¡£
Ò»ÔËÐУ¬±¨´í£ºÔÚ“¡¢”¸½¼þÓÐÓï·¨´íÎó¡£
ºÜÄÉÃÆ£¬ÄѵÀ³¬³¤ÁË£¿
³¢ÊÔÔÚÆóÒµ¹ÜÀíÆ÷ÖÐÌí¼ÓÕâ¸öÁÐÃû£¬·¢ÏÖÌí¼ÓÍêÖ®ºóϵͳ×Ô¶¯Ìí¼ÓÁËÒ»¶ÔÖÐÀ¨ºÅ£¬¶ÔÓÚ"aa¡¢bb","aa£¬bb"Ò²¶¼Ìí¼ÓÁËÖÐÀ¨ºÅ¡£
¿´À´ÊÇ΢ÈíΪÁËÒÔ·ÀÍòÒ»£¬Á¬ÖÐÎıêµãÒ²½÷É÷´¦ÀíÁË¡£
knowÁË~~
Ïà¹ØÎĵµ£º
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE proc pGetInsertSQL (@TableName varchar(256))
as
begin
set nocount on
declare @sqlstr varchar(4000)
declare @sqlstr1 varchar(4000)
declare @sqlstr2 v ......
----start
ÔÚSQLÓï¾äµÄ WHERE ×Ó¾äÖÐÓ¦¸Ã¾¡Á¿±ÜÃâÔÚ×Ö¶ÎÉÏʹÓú¯Êý£¬ÒòΪÕâÑù×ö»áʹ¸Ã×Ö¶ÎÉϵÄË÷ÒýʧЧ£¬Ó°ÏìSQLÓï¾äµÄÐÔÄÜ¡£¼´Ê¹¸Ã×Ö¶ÎÉÏûÓÐË÷Òý£¬Ò²Ó¦¸Ã±ÜÃâÔÚ×Ö¶ÎÉÏʹÓú¯Êý¡£¿¼ÂÇÏÂÃæµÄÇé¿ö£º
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---ÐÕÃû
REGISTERDATE TIMESTAMP---×¢² ......
Ò»¡¢Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû,Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí. ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í.µ±ORACLE´¦Àí¶à¸ö±íʱ, »áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á¬½ÓËüÃÇ ......
ÊÇ¿½±´µÄ±ðÈ˵ģ¬ÒÔ±¸Ñ§Ï°
package com.unmi.db;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* ¶ÁÈ¡ SQL ½Å±¾²¢Ö´ÐÐ
* @author Unmi
*/
pub ......
SQL ÖÐµÄ TRIM º¯Êý
ÊÇÓÃÀ´ÒƳýµôÒ»¸ö×Ö´®ÖеÄ×ÖÍ·»ò×Öβ¡£×î³£¼ûµÄÓÃ;ÊÇÒƳý×ÖÊ×»ò×ÖβµÄ¿Õ°×¡£Õâ¸öº¯ÊýÔÚ²»Í¬µÄ×ÊÁÏ¿âÖÐÓв»Í¬µÄÃû³Æ£º
MySQL: TRIM(), RTRIM(), LTRIM()
Oracle: RTRIM(), LTRIM()
SQL Server: RTRIM(), LTRIM()
¸÷ÖÖ trim º¯ÊýµÄÓï·¨ÈçÏ£º
TRIM ([[λÖÃ] [ÒªÒƳýµÄ×Ö´®] from ] ×Ö´®): [λÖà ......